/**
 * ParamQuery Pro
 * 
 * Copyright (c) 2012-2017 Paramvir Dhindsa (http://paramquery.com)
 * Released under Evaluation license
 * http://paramquery.com/pro/license/evaluate
 * 
 */
!
function() {
    var t = window.pq = window.pq || {},
    e = t.mixin = {};
    e.render = {
        getRenderVal: function(t, e, r) {
            var n = t.column,
            i = n.exportRender;
            return (e && i !== !1 || i) && (n.render || n._render || n.format) ? r.renderCell(t) : [t.rowData[t.dataIndx], ""]
        }
    }
} (),
function(t) {
    var e = t.ui.autocomplete.prototype,
    r = e._renderMenu,
    n = e._renderItem;
    e._renderMenu = function(e, n) {
        r.call(this, e, n);
        var i = this.options,
        o = i.selectItem;
        if (o && o.on) {
            var a = o.cls,
            a = void 0 === a ? "ui-state-highlight": a,
            l = this.element.val();
            l && a && t("a", e).filter(function() {
                return t(this).text() === l
            }).addClass(a)
        }
    },
    e._renderItem = function(t, e) {
        var r = n.call(this, t, e),
        i = this.options,
        o = i.highlightText;
        if (o && o.on) {
            var a = this.element.val();
            if (a) {
                var l = new RegExp("(" + a + ")", "i"),
                s = e.label;
                if (l.test(s)) {
                    var d = o.style,
                    d = void 0 === d ? "font-weight:bold;": d,
                    c = o.cls,
                    c = void 0 === c ? "": c;
                    s = s.replace(l, "<span style='" + d + "' class='" + c + "'>$1</span>"),
                    r.find("a").html(s)
                }
            }
        }
        return r
    };
    var i = t.paramquery = t.paramquery || {},
    o = function(t, e, r, n) {
        for (var i, o = e.slice(), a = 0, l = o.length, s = []; l > a; a++) {
            var d = o[a],
            c = d.cb,
            u = d.one;
            if (u) {
                if (d._oncerun) continue;
                d._oncerun = !0
            }
            if (i = c.call(t, r, n), i === !1 && (r.preventDefault(), r.stopPropagation()), u && s.push(a), r.isImmediatePropagationStopped()) break
        }
        if (l = s.length) for (a = l - 1; a >= 0; a--) o.splice(s[a], 1)
    };
    i._trigger = function(e, r, n) {
        var i, a, l = this,
        s = l.listeners,
        d = s[e],
        c = l.options,
        u = c.allEvents,
        h = c.bubble,
        f = l.element,
        p = c[e];
        if (n = n || {},
        r = t.Event(r), r.type = l.widgetName + ":" + e, r.target = f[0], a = r.originalEvent) for (i in a) i in r || (r[i] = a[i]);
        if (u && "function" == typeof u && u.call(l, r, n), d && d.length && (o(l, d, r, n), r.isImmediatePropagationStopped())) return ! r.isDefaultPrevented();
        if (c.trigger && (f[h ? "trigger": "triggerHandler"](r, n), r.isImmediatePropagationStopped())) return ! r.isDefaultPrevented();
        if (p) {
            var g = p.call(l, r, n);
            g === !1 && (r.preventDefault(), r.stopPropagation())
        }
        return d = s[e + "Done"],
        d && d.length && o(l, d, r, n),
        !r.isDefaultPrevented()
    };
    var a = function(t, e, r, n, i) {
        var o = t.listeners[e];
        o || (o = t.listeners[e] = []),
        o[i ? "unshift": "push"]({
            cb: r,
            one: n
        })
    };
    i.on = function() {
        var t = arguments;
        if ("boolean" == typeof t[0]) var e = t[0],
        r = t[1],
        n = t[2],
        i = t[3];
        else var r = t[0],
        n = t[1],
        i = t[2];
        for (var o = r.split(" "), l = 0; l < o.length; l++) {
            var s = o[l];
            s && a(this, s, n, i, e)
        }
        return this
    },
    i.one = function() {
        for (var t = arguments.length,
        e = [], r = 0; t > r; r++) e[r] = arguments[r];
        return e[t] = !0,
        this.on.apply(this, e)
    };
    var l = function(t, e, r) {
        if (r) {
            var n = t.listeners[e];
            if (n) {
                for (var i = [], o = 0, a = n.length; a > o; o++) {
                    var l = n[o],
                    s = l.cb;
                    r == s && i.push(o)
                }
                if (i.length) for (var o = i.length - 1; o >= 0; o--) n.splice(i[o], 1)
            }
        } else delete t.listeners[e]
    };
    i.off = function(t, e) {
        for (var r = t.split(" "), n = 0; n < r.length; n++) {
            var i = r[n];
            i && l(this, i, e)
        }
        return this
    };
    var s = {
        options: {
            items: ".pq-grid-cell.pq-has-tooltip,.pq-grid-cell[title]",
            position: {
                my: "center top",
                at: "center bottom"
            },
            content: function() {
                var e = t(this),
                r = e.closest(".pq-grid"),
                n = r.pqGrid("instance"),
                i = n.getCellIndices({
                    $td: e
                }),
                o = i.rowIndx,
                a = i.dataIndx,
                l = n.data({
                    rowIndx: o,
                    dataIndx: a,
                    data: "pq_valid"
                }).data;
                if (l) {
                    var s = l.icon,
                    d = l.msg;
                    d = null != d ? d: "";
                    var c = "" == s ? "": "<span class='ui-icon " + s + " pq-tooltip-icon'></span>";
                    return c + d
                }
                return e.attr("title")
            }
        }
    };
    s._create = function() {
        this._super();
        var e = this.element,
        r = this.eventNamespace;
        e.on("pqtooltipopen" + r,
        function(e, r) {
            var n = t(e.target),
            i = t(e.originalEvent.target);
            if (i.on("remove.pqtt",
            function(t) {
                n.pqTooltip("close", t, !0)
            }), n.is(".pq-grid")) {
                var o, a = n.pqGrid("instance"),
                l = a.getCellIndices({
                    $td: i
                }),
                s = l.rowIndx,
                d = l.dataIndx,
                c = a.getRowData({
                    rowIndx: s
                });
                if ((o = c) && (o = o.pq_celldata) && (o = o[d]) && (o = o.pq_valid)) {
                    var u = o,
                    h = u.style,
                    f = u.cls;
                    r.tooltip.addClass(f);
                    var p = r.tooltip.attr("style");
                    r.tooltip.attr("style", p + ";" + h)
                }
            }
        }),
        e.on("pqtooltipclose" + r,
        function(e, r) {
            var n = (t(e.target), t(e.originalEvent.target));
            n.off(".pqtt")
        })
    },
    t.widget("paramquery.pqTooltip", t.ui.tooltip, s)
} (jQuery),
function(t) {
    t.paramquery = t.paramquery || {},
    t.paramquery.onResize = function(e, r) {
        var n = !1,
        i = t(e);
        if ("static" === i.css("position") && i.css("position", "relative"), !n) {
            var o = t('<iframe type="text/html" src="about:blank" class="pq-resize-iframe" style="display:block;width:100%;height:100%;position:absolute;top:0;left:0;z-index:-1;overflow: hidden; pointer-events: none;" />').appendTo(i);
            o[0].data = "about:blank",
            o.css("opacity", "0")
        }
        for (var a = 0; a < i.length; a++) if (n) t(i[a]).on("resize",
        function(t) {
            r.call(e, t)
        });
        else {
            var l = o[a],
            s = t(l.contentWindow);
            s.on("resize",
            function(t) {
                r.call(e, t)
            })
        }
    }
} (jQuery),
function(t) {
    function e(t) {
        return t.charCodeAt(0) - 64
    }
    var r = t.paramquery,
    n = Array.prototype; ! n.find && (n.find = function(t, e) {
        for (var r, n = 0,
        i = this.length; i > n; n++) if (r = this[n], t.call(e, r, n, this)) return r
    }),
    !n.findIndex && (n.findIndex = function(t, e) {
        for (var r, n = 0,
        i = this.length; i > n; n++) if (r = this[n], t.call(e, r, n, this)) return n;
        return - 1
    });
    var i = t.extend(window.pq, {
        arrayUnique: function(t, e) {
            var r, n, i, o = [],
            a = t.length,
            l = {};
            for (r = 0; a > r; r++) n = t[r],
            i = e ? n[e] : n,
            l.hasOwnProperty(i) || (l[i] = 1, o.push(n));
            return o
        },
        escapeHtml: function(t) {
            return t.replace(/&/g, "&amp;").replace(/</g, "&lt;")
        },
        escapeXml: function(t) {
            return t.replace(/&/g, "&amp;").replace(/</g, "&lt;")
        },
        excelToJui: function() {
            var t = {};
            return function(e) {
                var r = t[e];
                return r || (r = e.replace(/yy/g, "y").replace(/dddd/g, "DD").replace(/ddd/g, "D").replace(/mmmm/g, "MM").replace(/mmm/g, "M"), t[e] = r),
                r
            }
        } (),
        excelToNum: function() {
            var t = {};
            return function(e) {
                var r = t[e];
                return r || (r = e.replace(/\\/g, ""), t[e] = r),
                r
            }
        } (),
        flatten: function(t, e) {
            var r, n = 0,
            o = t.length;
            for (e = e || []; o > n; n++) r = t[n],
            null != r && (r.push ? i.flatten(r, e) : e.push(r));
            return e
        },
        toRC: function(t) {
            var e = t.match(/([A-Z]+)(\d+)/),
            r = i.toNumber(e[1]),
            n = e[2] - 1;
            return [n, r]
        },
        getAddress: function(t) {
            var e = t.split(":"),
            r = this.toRC(e[0]),
            n = r[0],
            i = r[1],
            o = this.toRC(e[1] || e[0]),
            a = o[0],
            l = o[1],
            s = a - n + 1,
            d = l - i + 1;
            return {
                r1: n,
                c1: i,
                rc: s,
                cc: d,
                r2: a,
                c2: l
            }
        },
        getFn: function() {
            var t = {};
            return function(e) {
                var r = e;
                return "string" == typeof e && ((r = t[e]) || (r = window, e.split(".").forEach(function(t) {
                    r = r[t]
                }), t[e] = r)),
                r
            }
        } (),
        isDateFormat: function() {
            var t = {};
            return function(e) {
                var r = t[e];
                return null == r && (r = t[e] = /^[mdy\s-\/]*$/i.test(e)),
                r
            }
        } (),
        isEmpty: function(t) {
            for (var e in t) return ! 1;
            return ! 0
        },
        juiToExcel: function() {
            var t = {};
            return function(e) {
                var r = t[e];
                return r || (r = e.replace(/y/g, "yy").replace(/DD/g, "dddd").replace(/D/g, "ddd").replace(/MM/g, "mmmm").replace(/M/g, "mmm"), t[e] = r),
                r
            }
        } (),
        newLine: function(t) {
            return isNaN(t) && "string" == typeof t ? t.replace(/(\r\n|\r|\n)/g, "<br>") : t
        },
        numToExcel: function() {
            var t = {};
            return function(e) {
                var r = t[e];
                return r || (r = e.replace(/[^#0,.@]/g,
                function(t) {
                    return "\\" + t
                }), t[e] = r),
                r
            }
        } (),
        unescapeXml: function() {
            var t = {
                amp: "&",
                lt: "<",
                gt: ">",
                quot: '"',
                apos: "'"
            };
            return function(e) {
                return e.replace(/&(amp|lt|gt|quot|apos);/g,
                function(e, r) {
                    return t[r]
                })
            }
        } ()
    });
    r.select = function(t) {
        var e, r, n, i = t.attr,
        o = t.options,
        a = t.groupIndx,
        l = t.labelIndx,
        s = t.valueIndx,
        d = null != l && null != s,
        c = null != a,
        u = t.prepend,
        h = t.dataMap,
        f = function() {
            for (var t = {},
            e = 0; e < h.length; e++) {
                var r = h[e];
                t[r] = w[r]
            }
            return "data-map='" + JSON.stringify(t) + "'"
        },
        p = ["<select ", i, " >"];
        if (u) for (var g in u) p.push('<option value="', g, '">', u[g], "</option>");
        if (o && o.length) {
            for (var v = 0,
            m = o.length; m > v; v++) {
                var w = o[v];
                if (d) {
                    var x = w[s],
                    y = w.pq_disabled ? 'disabled="disabled" ': "",
                    C = w.pq_selected ? 'selected="selected" ': "";
                    if (null == x) continue;
                    if (n = h ? f() : "", c) {
                        var _ = w.pq_disabled_group ? 'disabled="disabled" ': "";
                        e = w[a],
                        r != e && (null != r && p.push("</optgroup>"), p.push('<optgroup label="', e, '" ', _, " >"), r = e)
                    }
                    if (l == s) p.push("<option ", C, y, n, ">", x, "</option>");
                    else {
                        var I = w[l];
                        p.push("<option ", C, y, n, ' value="', x, '">', I, "</option>")
                    }
                } else if ("object" == typeof w) for (var g in w) p.push('<option value="', g, '">', w[g], "</option>");
                else p.push("<option>", w, "</option>")
            }
            c && p.push("</optgroup>")
        }
        return p.push("</select>"),
        p.join("")
    },
    t.fn.pqval = function(t) {
        if (t) {
            if (t.incr) {
                var e = this.data("pq_value");
                return this.prop("indeterminate", !1),
                e ? (e = !1, this.prop("checked", !1)) : e === !1 ? (e = null, this.prop("indeterminate", !0), this.prop("checked", !1)) : (e = !0, this.prop("checked", !0)),
                this.data("pq_value", e),
                e
            }
            var e = t.val;
            return this.data("pq_value", e),
            this.prop("indeterminate", !1),
            null == e ? (this.prop("indeterminate", !0), this.prop("checked", !1)) : e ? this.prop("checked", !0) : this.prop("checked", !1),
            this
        }
        return this.data("pq_value")
    },
    r.xmlToArray = function(e, r) {
        var n = r.itemParent,
        i = r.itemNames,
        o = [],
        a = t(e).find(n);
        return a.each(function(e, r) {
            var n = t(r),
            a = [];
            t(i).each(function(t, e) {
                a.push(n.find(e).text().replace(/\r|\n|\t/g, ""))
            }),
            o.push(a)
        }),
        o
    },
    r.xmlToJson = function(e, r) {
        var n = r.itemParent,
        i = r.itemNames,
        o = [],
        a = t(e).find(n);
        return a.each(function(e, r) {
            for (var n = t(r), a = {},
            l = 0, s = i.length; s > l; l++) {
                var d = i[l];
                a[d] = n.find(d).text().replace(/\r|\n|\t/g, "")
            }
            o.push(a)
        }),
        o
    },
    r.tableToArray = function(e) {
        var r = t(e),
        n = [],
        i = [],
        o = r.children("tbody").children("tr"),
        a = o.length ? t(o[0]) : t(),
        l = o.length > 1 ? t(o[1]) : t();
        return a.children("th,td").each(function(e, r) {
            var i = t(r),
            o = i.html(),
            a = i.width(),
            s = "left",
            d = "string";
            if (l.length) var c = l.find("td:eq(" + e + ")"),
            u = c.attr("align"),
            s = u ? u: s;
            var h = {
                title: o,
                width: a,
                dataType: d,
                align: s,
                dataIndx: e
            };
            n.push(h)
        }),
        o.each(function(e, r) {
            if (0 != e) {
                var n = t(r),
                o = [];
                n.children("td").each(function(e, r) {
                    o.push(t.trim(t(r).html()))
                }),
                i.push(o)
            }
        }),
        {
            data: i,
            colModel: n
        }
    };
    var o = function(t) {
        return function(e, r) {
            var n, i, o, a;
            if (e) {
                if (i = e.split(":"), e = r && i.length > 1 ? i[1] : i[0], n = t[e]) return n;
                o = /^([^#]*|&#[^#]*)?[\,\.#0]*?([\,\s\.]?)([#0]*)([\,\s\.]?)([0]*?)(\s*[^#^0]*|&#[^#]*)?$/,
                a = e.match(o),
                a && a.length && (n = {
                    symbol: a[1] || "",
                    thouSep: a[2],
                    thousand: a[3].length,
                    decSep: a[4],
                    decimal: a[5].length,
                    symbolEnd: a[6] || ""
                },
                t[e] = n)
            }
            return n = n || {
                symbol: "",
                symbolEnd: "",
                thouSep: ",",
                thousand: 3,
                decSep: ".",
                decimal: 2
            }
        }
    } ({});
    r.formatCurrency = function(t, e) {
        var r = parseFloat(t);
        if (!isNaN(r)) {
            var n = 0 > r,
            i = o(e, n),
            a = i.symbol,
            l = i.symbolEnd,
            s = i.thousand,
            d = i.thouSep,
            c = i.decSep,
            u = i.decimal;
            r = r.toFixed(u);
            for (var h = r.length,
            f = u + c.length,
            p = r.substring(0, h - f), g = r.substring(h - f + c.length, h), v = p.match(/\d/g).reverse(), m = [], w = 0; w < v.length; w++) w > 0 && w % s == 0 && m.push(d),
            m.push(v[w]);
            return m = m.reverse(),
            p = m.join(""),
            (n ? "-": "") + a + p + c + g + l
        }
    },
    i.formatNumber = r.formatCurrency,
    i.validation = {
        is: function(t, e) {
            return "string" != t && t ? (t = t.substring(0, 1).toUpperCase() + t.substring(1, t.length), this["is" + t](e)) : !0
        },
        isFloat: function(t) {
            var e = parseFloat(t);
            return ! isNaN(e) && e == t
        },
        isInteger: function(t) {
            var e = parseInt(t);
            return ! isNaN(e) && e == t
        },
        isDate: function(t) {
            var e = Date.parse(t);
            return ! isNaN(e)
        }
    };
    var a = [],
    l = {},
    s = i.toLetter = function(t) {
        var e = a[t];
        if (!e) {
            t++;
            var r = t % 26,
            n = t / 26 | 0,
            i = r ? String.fromCharCode(64 + r) : (--n, "Z");
            e = n ? s(n - 1) + i: i,
            t--,
            a[t] = e,
            l[e] = t
        }
        return e
    };
    i.toNumber = function(t) {
        var r, n, i, o, s, d = l[t];
        if (null == d) {
            for (r = t.length, d = -1, n = 0; r > n; n++) i = t[n],
            o = e(i),
            s = r - n - 1,
            d += o * Math.pow(26, s);
            a[d] = t,
            l[t] = d
        }
        return d
    },
    i.generateData = function(t, e) {
        for (var r = [], n = 0; e > n; n++) r[n] = s(n);
        for (var i = [], n = 0; t > n; n++) for (var o = i[n] = [], a = 0; e > a; a++) o[a] = r[a] + (n + 1);
        return i
    }
} (jQuery),
function(t) {
    pq.validations = {
        minLen: function(t, e, r) {
            return t = r(t),
            e = r(e),
            t.length >= e ? !0 : void 0
        },
        nonEmpty: function(t) {
            return null != t && "" !== t ? !0 : void 0
        },
        maxLen: function(t, e, r) {
            return t = r(t),
            e = r(e),
            t.length <= e ? !0 : void 0
        },
        gt: function(t, e, r) {
            return t = r(t),
            e = r(e),
            t > e ? !0 : void 0
        },
        gte: function(t, e, r) {
            return t = r(t),
            e = r(e),
            t >= e ? !0 : void 0
        },
        lt: function(t, e, r) {
            return t = r(t),
            e = r(e),
            e > t ? !0 : void 0
        },
        lte: function(t, e, r) {
            return t = r(t),
            e = r(e),
            e >= t ? !0 : void 0
        },
        neq: function(t, e, r) {
            return t = r(t),
            e = r(e),
            t !== e ? !0 : void 0
        },
        regexp: function(t, e) {
            return new RegExp(e).test(t) ? !0 : void 0
        }
    };
    var e = t.paramquery;
    e.cValid = function(t) {
        this.that = t
    };
    var r = e.cValid.prototype;
    r._isValidCell = function(t) {
        var e = this.that,
        r = t.column,
        n = r.validations;
        if (!n || !n.length) return {
            valid: !0
        };
        var i, o = t.value,
        a = r.dataType,
        l = function(t) {
            return e.getValueFromDataType(t, a, !0)
        },
        s = t.rowData;
        if (!s) throw "rowData required.";
        for (var d = 0; d < n.length; d++) {
            var c = n[d],
            u = c.on,
            h = c.type,
            f = !1,
            p = c.msg,
            g = c.value;
            if (u !== !1) {
                if (i = pq.validations[h]) f = null == o ? !1 : i(o, g, l);
                else if (h) {
                    var v = {
                        column: r,
                        value: o,
                        rowData: s,
                        msg: p
                    };
                    e.callFn(h, v) === !1 ? (f = !1, p = v.msg) : f = !0
                } else f = !0;
                if (!f) return {
                    valid: !1,
                    msg: p,
                    column: r,
                    warn: c.warn,
                    dataIndx: r.dataIndx,
                    validation: c
                }
            }
        }
        return {
            valid: !0
        }
    },
    r.onScrollCell = function(t, e, r, n, i, o) {
        var a, l = this.that,
        s = l.options,
        d = s.bootstrap;
        if (t || (a = l.getEditCell()) && a.$cell) {
            var c = t || a.$cell;
            c.attr("title", e);
            var u = "tooltip",
            h = "open";
            d.on && d.tooltip && (u = d.tooltip, h = "show");
            try {
                c[u]("destroy")
            } catch(f) {}
            c[u]({
                trigger: "manual",
                position: {
                    my: "left center+5",
                    at: "right center"
                },
                content: function() {
                    var t = "" == r ? "": "<span class='ui-icon " + r + " pq-tooltip-icon'></span>";
                    return t + e
                },
                open: function(t, e) {
                    var r = e.tooltip;
                    if (n && r.addClass(n), o) {
                        var a = r.attr("style");
                        r.attr("style", a + ";" + o)
                    }
                    i && r.tooltip.css(i)
                }
            })[u](h)
        }
    },
    r.isValidCell = function(e) {
        var r = this,
        n = this.that,
        i = e.rowData,
        o = e.rowIndx,
        a = e.value,
        l = e.valueDef,
        s = e.column,
        d = e.focusInvalid,
        c = n.options,
        u = (c.bootstrap, e.allowInvalid),
        h = s.dataIndx,
        f = c.validation,
        p = c.warning,
        g = c.editModel,
        v = g.invalidClass,
        m = g.warnClass,
        w = document.activeElement;
        if (e.checkEditable && 0 == n.isEditableCell({
            rowIndx: o,
            dataIndx: h
        })) return {
            valid: !0
        };
        var x = this._isValidCell({
            column: s,
            value: a,
            rowData: i
        }),
        y = x.valid,
        C = x.warn,
        _ = x.msg;
        if (y) n.data({
            rowData: i,
            dataIndx: h,
            data: "pq_valid"
        }) && (n.removeClass({
            rowData: i,
            rowIndx: o,
            dataIndx: h,
            cls: m + " " + v
        }), n.removeData({
            rowData: i,
            dataIndx: h,
            data: "pq_valid"
        }));
        else var I = t.extend({},
        C ? p: f, x.validation),
        b = I.css,
        q = I.cls,
        R = I.icon,
        D = I.style;
        if (u || C) return y ? {
            valid: !0
        }: (n.addClass({
            rowData: i,
            rowIndx: o,
            dataIndx: h,
            cls: C ? m: v
        }), n.data({
            rowData: i,
            dataIndx: h,
            data: {
                pq_valid: {
                    css: b,
                    icon: R,
                    style: D,
                    msg: _,
                    cls: q
                }
            }
        }), x);
        if (!y) {
            if (null == o) {
                var M = n.getRowIndx({
                    rowData: i,
                    dataUF: !0
                }),
                o = M.rowIndx;
                if (null == o || M.uf) return x.uf = M.uf,
                x
            }
            if (d) {
                var T;
                if (l) {
                    if (t(w).hasClass("pq-editor-focus")) {
                        var E = c.editModel.indices;
                        if (E) {
                            var S = E.rowIndx,
                            P = E.dataIndx;
                            if (null != o && o != S) throw "incorrect usage of isValid rowIndx: " + o;
                            if (h != P) throw "incorrect usage of isValid dataIndx: " + h;
                            n.editCell({
                                rowIndx: S,
                                dataIndx: h
                            })
                        }
                    }
                } else {
                    n.goToPage({
                        rowIndx: o
                    });
                    var k = {
                        rowIndx: o,
                        dataIndx: h
                    },
                    k = n.normalize(k);
                    T = n.getCell(k),
                    n.scrollCell(k,
                    function() {
                        r.onScrollCell(T, _, R, q, b, D),
                        n.focus(k)
                    })
                }
                this.onScrollCell(T, _, R, q, b, D)
            }
            return x
        }
        if (l) {
            var A = n.getEditCell();
            if (A && A.$cell) {
                var H = A.$cell;
                H.removeAttr("title");
                try {
                    H.tooltip("destroy")
                } catch(F) {}
            }
        }
        return {
            valid: !0
        }
    },
    r.isValid = function(t) {
        t = t || {};
        var e = this.that,
        r = t.allowInvalid,
        n = t.focusInvalid,
        i = t.checkEditable,
        r = null == r ? !1 : r,
        o = t.dataIndx;
        if (null != o) {
            var a = e.columns[o],
            l = t.rowData || e.getRowData(t),
            s = t.hasOwnProperty("value"),
            d = s ? t.value: l[o],
            c = this.isValidCell({
                rowData: l,
                checkEditable: i,
                rowIndx: t.rowIndx,
                value: d,
                valueDef: s,
                column: a,
                allowInvalid: r,
                focusInvalid: n
            });
            return c.valid || c.warn ? {
                valid: !0
            }: c
        }
        if (null != t.rowIndx || null != t.rowIndxPage || null != t.rowData) {
            for (var l = t.rowData || e.getRowData(t), u = e.colModel, h = [], f = 0, p = u.length; p > f; f++) {
                var a = u[f],
                g = a.hidden;
                if (!g) {
                    var o = a.dataIndx,
                    d = l[o],
                    c = this.isValidCell({
                        rowData: l,
                        value: d,
                        column: a,
                        rowIndx: t.rowIndx,
                        checkEditable: i,
                        allowInvalid: r,
                        focusInvalid: n
                    });
                    if (!c.valid && !c.warn) {
                        if (!r) return c;
                        h.push({
                            rowData: l,
                            dataIndx: o,
                            column: a
                        })
                    }
                }
            }
            return r && h.length ? {
                cells: h,
                valid: !1
            }: {
                valid: !0
            }
        }
        var v = t.data ? t.data: e.options.dataModel.data,
        h = [];
        if (!v) return null;
        for (var f = 0,
        p = v.length; p > f; f++) {
            var m, l = v[f];
            if (!i || (m = this.getRowIndx({
                rowData: l
            }).rowIndx, null != m && 0 != e.isEditableRow({
                rowData: l,
                rowIndx: m
            }))) {
                var w = this.isValid({
                    rowData: l,
                    rowIndx: m,
                    checkEditable: i,
                    allowInvalid: r,
                    focusInvalid: n
                }),
                x = w.cells;
                if (r === !1) {
                    if (!w.valid) return w
                } else x && x.length && (h = h.concat(x))
            }
        }
        return r && h.length ? {
            cells: h,
            valid: !1
        }: {
            valid: !0
        }
    }
} (jQuery),
function(t) {
    function e(e, r, n) {
        return t(e ? "<span tabindex='0' rel='tooltip' data-placement='top' title='" + r + "' class='btn btn-xs " + n + "'></span>": "<span class='pq-ui-button ui-widget-header' tabindex='0' rel='tooltip' title='" + r + "'><span class='ui-icon ui-icon-" + n + "'></span></span>")
    }
    function r(e, r) {
        e.bind("click keydown",
        function(e) {
            return "keydown" != e.type || e.keyCode == t.ui.keyCode.ENTER ? r.call(this, e) : void 0
        })
    }
    function n(t, e, r) {
        e[r ? "addClass": "removeClass"]("disabled").css("pointer-events", r ? "none": "").attr("tabindex", r ? "": "0")
    }
    var i = {};
    i.options = {
        bootstrap: {
            on: !1,
            pager: "",
            nextIcon: "glyphicon glyphicon-forward",
            prevIcon: "glyphicon glyphicon-backward",
            firstIcon: "glyphicon glyphicon-step-backward",
            lastIcon: "glyphicon glyphicon-step-forward",
            refreshIcon: "glyphicon glyphicon-refresh"
        },
        curPage: 0,
        totalPages: 0,
        totalRecords: 0,
        msg: "",
        rPPOptions: [10, 20, 30, 40, 50, 100],
        rPP: 20
    },
    i._regional = {
        strDisplay: "Displaying {0} to {1} of {2} items.",
        strFirstPage: "First Page",
        strLastPage: "Last Page",
        strNextPage: "Next Page",
        strPage: "Page {0} of {1}",
        strPrevPage: "Previous Page",
        strRefresh: "Refresh",
        strRpp: "Records per page:{0}"
    },
    t.extend(i.options, i._regional),
    i._create = function() {
        var n = this,
        i = this.options,
        o = this.element,
        a = i.bootstrap,
        l = a.on;
        this.listeners = {},
        o.addClass("pq-pager " + (l ? a.pager: "")),
        this.first = e(l, i.strFirstPage, l ? a.firstIcon: "seek-first").appendTo(o),
        r(this.first,
        function(t) {
            i.curPage > 1 && n._onChange(t, 1)
        }),
        this.prev = e(l, i.strPrevPage, l ? a.prevIcon: "seek-prev").appendTo(o),
        r(this.prev,
        function(t) {
            if (i.curPage > 1) {
                var e = i.curPage - 1;
                n._onChange(t, e)
            }
        }),
        t("<span class='pq-separator'></span>").appendTo(o),
        this.pageHolder = t("<span class='pq-page-placeholder'></span>").appendTo(o),
        t("<span class='pq-separator'></span>").appendTo(o),
        this.next = e(l, i.strNextPage, l ? a.nextIcon: "seek-next").appendTo(o),
        r(this.next,
        function(t) {
            if (i.curPage < i.totalPages) {
                var e = i.curPage + 1;
                n._onChange(t, e)
            }
        }),
        this.last = e(l, i.strLastPage, l ? a.lastIcon: "seek-end").appendTo(o),
        r(this.last,
        function(t) {
            if (i.curPage !== i.totalPages) {
                var e = i.totalPages;
                n._onChange(t, e)
            }
        }),
        t("<span class='pq-separator'></span>").appendTo(o),
        this.rPPHolder = t("<span class='pq-page-placeholder'></span>").appendTo(o),
        this.$refresh = e(l, i.strRefresh, l ? a.refreshIcon: "refresh").appendTo(o),
        r(this.$refresh,
        function(t) {
            return n._trigger("beforeRefresh", t) === !1 ? !1 : void n._trigger("refresh", t)
        }),
        t("<span class='pq-separator'></span>").appendTo(o),
        this.$msg = t("<span class='pq-pager-msg'></span>").appendTo(o),
        this._refresh()
    },
    i._destroy = function() {
        this.element.empty().removeClass("pq-pager").enableSelection()
    },
    i._setOption = function(t, e) {
        "curPage" != t && "totalPages" != t || (e = 1 * e),
        this._super(t, e)
    },
    i._setOptions = function(e) {
        var r, n = !1,
        i = this.options;
        for (r in e) {
            var o = e[r],
            a = typeof o;
            "string" == a || "number" == a ? o != i[r] && (this._setOption(r, o), n = !0) : "function" == typeof o.splice || t.isPlainObject(o) ? JSON.stringify(o) != JSON.stringify(i[r]) && (this._setOption(r, o), n = !0) : o != i[r] && (this._setOption(r, o), n = !0)
        }
        return n && this._refresh(),
        this
    },
    t.widget("paramquery.pqPager", i),
    pq.pager = function(e, r) {
        var n = t(e).pqPager(r),
        i = n.data("paramqueryPqPager") || n.data("paramquery-pqPager");
        return i
    };
    var o = t.paramquery;
    o.pqPager.regional = {},
    o.pqPager.regional.en = i._regional,
    i = o.pqPager.prototype,
    o.pqPager.defaults = i.options,
    i._refreshPage = function() {
        var e = this;
        this.pageHolder.empty();
        for (var r = this.options,
        n = r.bootstrap,
        i = r.strPage,
        o = i.split(" "), a = [], l = 0, s = o.length; s > l; l++) {
            var d = o[l];
            "{0}" == d ? a.push("<input type='text' tabindex='0' class='pq-pager-input ", n.on ? "": "ui-corner-all", "' />") : "{1}" == d ? a.push("<span class='total'></span>") : a.push("<span>", d, "</span>")
        }
        var c = a.join(""),
        u = t(c).appendTo(this.pageHolder);
        this.page = u.filter("input").bind("keydown",
        function(e) {
            e.keyCode === t.ui.keyCode.ENTER && t(this).trigger("change")
        }).bind("change",
        function(n) {
            var i = t(this),
            o = i.val();
            return isNaN(o) || 1 > o ? (i.val(r.curPage), !1) : (o = parseInt(o), o !== r.curPage ? o > r.totalPages ? (i.val(r.curPage), !1) : e._onChange(n, o) === !1 ? (i.val(r.curPage), !1) : void 0 : void 0)
        }),
        this.$total = u.filter("span.total")
    },
    i._onChange = function(t, e) {
        return this._trigger("beforeChange", t, {
            curPage: e
        }) === !1 ? !1 : this._trigger("change", t, {
            curPage: e
        }) === !1 ? !1 : void this.option({
            curPage: e
        })
    },
    i._refresh = function() {
        this._refreshPage();
        var e = (this.$rPP, this),
        r = this.options,
        i = r.bootstrap;
        if (this.rPPHolder.empty(), r.strRpp) {
            var o = r.rPPOptions,
            a = r.strRpp;
            if ( - 1 != a.indexOf("{0}")) {
                for (var l = ["<select class='", i.on ? "": "ui-corner-all", "'>"], s = 0, d = o.length; d > s; s++) {
                    var c = o[s];
                    l.push('<option value="', c, '">', c, "</option>")
                }
                l.push("</select>");
                var u = l.join("");
                a = a.replace("{0}", "</span>" + u),
                a = "<span>" + a + "<span class='pq-separator'></span>"
            } else a = "<span>" + a + "</span><span class='pq-separator'></span>";
            this.$rPP = t(a).appendTo(this.rPPHolder).filter("select").val(r.rPP).change(function(r) {
                var n = t(this),
                i = n.val();
                return e._trigger("beforeChange", r, {
                    rPP: i
                }) === !1 ? (n.val(e.options.rPP), !1) : void(e._trigger("change", r, {
                    rPP: i
                }) !== !1 && (e.options.rPP = i))
            })
        }
        var h = r.bootstrap.on,
        f = r.curPage >= r.totalPages;
        n(h, this.next, f),
        n(h, this.last, f);
        var f = r.curPage <= 1;
        if (n(h, this.first, f), n(h, this.prev, f), this.page.val(r.curPage), this.$total.text(r.totalPages), this.options.totalRecords > 0) {
            var p = r.rPP,
            g = r.curPage,
            v = r.totalRecords,
            m = (g - 1) * p,
            w = g * p;
            w > v && (w = v);
            var x = r.strDisplay;
            x = x.replace("{0}", m + 1),
            x = x.replace("{1}", w),
            x = x.replace("{2}", v),
            this.$msg.html(x)
        } else this.$msg.html("")
    },
    i.getInstance = function() {
        return {
            pager: this
        }
    },
    i._trigger = o._trigger,
    i.on = o.on,
    i.one = o.one,
    i.off = o.off
} (jQuery),
function(t) {
    function e(t) {
        return "<span class='btn btn-xs glyphicon glyphicon-" + t + "' ></span>"
    }
    function r(t) {
        return "<span class='ui-widget-header pq-ui-button'><span class='ui-icon ui-icon-" + t + "'></span></span>"
    }
    var n = function() {};
    n.prototype = {
        belongs: function(t) {
            return t.target == this.that.element[0] ? !0 : void 0
        },
        setTimer: function(t, e) {
            var r = this;
            clearTimeout(r._timeID),
            r._timeID = setTimeout(function() {
                t()
            },
            e)
        }
    };
    var i = t.paramquery;
    i.cClass = n;
    var o = {
        widgetEventPrefix: "pqgrid"
    };
    o._create = function() {
        var e = this,
        r = this.options,
        n = this.element,
        o = r.dataModel,
        a = r.bootstrap,
        l = a.on,
        s = r.roundCorners && !l,
        d = r.ui,
        c = r.sortModel;
        if (t(document).triggerHandler("pqGrid:bootup", {
            instance: this
        }), this.BS_on = l, r.collapsible || (r.collapsible = {
            on: !1,
            collapsed: !1
        }), r.flexHeight && (r.height = "flex"), r.flexWidth && (r.width = "flex"), o.sortIndx) {
            c.on = r.sortable,
            c.type = o.sorting;
            var u = [],
            h = o.sortIndx,
            f = o.sortDir;
            if (t.isArray(h)) {
                for (var p = 0; p < h.length; p++) {
                    var g = f && f[p] ? f[p] : "up";
                    u.push({
                        dataIndx: h[p],
                        dir: g
                    })
                }
                c.single = !1
            } else {
                var g = f ? f: "up";
                u.push({
                    dataIndx: h,
                    dir: g
                }),
                c.single = !0
            }
            c.sorter = u
        }
        this.iRefresh = new i.cRefresh(this),
        this.iKeyNav = new i.cKeyNav(this),
        this.iValid = new i.cValid(this),
        this.tables = [],
        this.$tbl = null,
        this.iColModel = new i.cColModel(this),
        this.iSort = new i.cSort(this),
        this._initTypeColumns(),
        n.on("scroll" + this.eventNamespace,
        function() {
            this.scrollLeft = 0,
            this.scrollTop = 0
        }).on("mousedown" + this.eventNamespace, this._mouseDown.bind(this));
        var v = l ? a.grid: d.grid,
        m = l ? "": d.header_o,
        w = l ? "": d.bottom,
        x = l ? a.top: d.top;
        n.empty().attr("role", "grid").addClass("pq-grid " + v + " " + (s ? " ui-corner-all": "")).html(["<div class='pq-grid-top ", x, " ", s ? " ui-corner-top": "", "'>", "<div class='pq-grid-title", s ? " ui-corner-top": "", "'>&nbsp;</div>", "</div>", "<div class='pq-grid-center' >", "<div class='pq-header-outer ", m, "'></div>", "<div class='pq-body-outer' tabindex='0' >", "</div>", "<div class='pq-summary-outer' ></div>", "</div>", "<div class='pq-grid-bottom ", w, " ", s ? " ui-corner-bottom": "", "'>", "<div class='pq-grid-footer'></div>", "</div>"].join("")),
        this.$bottom = t(".pq-grid-bottom", n),
        this.$summary = t(".pq-summary-outer", n),
        this.$top = t("div.pq-grid-top", n),
        r.showTop || this.$top.css("display", "none"),
        this.$title = t("div.pq-grid-title", n),
        r.showTitle || this.$title.css("display", "none");
        var y = this.$grid_center = t(".pq-grid-center", n).on("scroll",
        function() {
            this.scrollTop = 0
        });
        this.addTouch(),
        this.$header = t(".pq-header-outer", y).on("scroll",
        function() {
            this.scrollTop = 0,
            this.scrollLeft = 0
        }),
        this.iHeader = new i.cHeader(this, this.$header),
        this.$footer = t(".pq-grid-footer", n);
        var C = this.$cont = t(".pq-body-outer", y);
        this.iRenderB = new pq.cRenderBody(e, {
            $center: y,
            $b: C,
            $sum: this.$summary,
            header: !0,
            $h: this.$header
        }),
        this._trigger("render", null, {
            dataModel: this.options.dataModel,
            colModel: this.colModel
        }),
        C.on("click", ".pq-grid-cell,.pq-grid-number-cell",
        function(r) {
            return t.data(r.target, e.widgetName + ".preventClickEvent") !== !0 && e.evtBelongs(r) ? e._onClickCell(r) : void 0
        }),
        C.on("click", ".pq-grid-row",
        function(r) {
            return t.data(r.target, e.widgetName + ".preventClickEvent") !== !0 && e.evtBelongs(r) ? e._onClickRow(r) : void 0
        }).on("contextmenu", ".pq-grid-cell",
        function(t) {
            return e.evtBelongs(t) ? e._onRightClickCell(t) : void 0
        }).on("contextmenu", ".pq-grid-row",
        function(t) {
            return e.evtBelongs(t) ? e._onRightClickRow(t) : void 0
        }).on("dblclick", ".pq-grid-cell",
        function(t) {
            return e.evtBelongs(t) ? e._onDblClickCell(t) : void 0
        }).on("dblclick", ".pq-grid-row",
        function(t) {
            return e.evtBelongs(t) ? e._onDblClickRow(t) : void 0
        }),
        C.on("focusout",
        function() {
            e.onblur()
        }).on("focus",
        function(t) {
            e.onfocus(t)
        }).on("mousedown", e._onMouseDown(e)).on("change", e._onChange(e)),
        C.on("mouseenter", ".pq-grid-cell", e._onCellMouseEnter(e)).on("mouseenter", ".pq-grid-row", e._onRowMouseEnter(e)).on("mouseleave", ".pq-grid-cell", e._onCellMouseLeave(e)).on("mouseleave", ".pq-grid-row", e._onRowMouseLeave(e)).on("keyup", e._onKeyUp(e)),
        r.selectionModel["native"] || this.disableSelection(),
        y.bind("keydown.pq-grid", e._onKeyPressDown(e)),
        this._refreshTitle(),
        this.iRows = new i.cRows(this),
        this.generateLoading(),
        this._initPager(),
        this._refreshResizable(),
        this._refreshDraggable(),
        this.iResizeColumns = new i.cResizeColumns(this)
    },
    o.addTouch = function() {
        var e, r, n;
        "ontouchend" in document && (n = this.$grid_center[0], n.addEventListener("touchstart",
        function(n) {
            var i = n.target,
            o = n.changedTouches[0];
            if (t(i).trigger("mousedown", n), e) {
                if (i && i == e.target) {
                    var a = e.x - o.pageX,
                    l = e.y - o.pageY,
                    s = Math.sqrt(a * a + l * l);
                    12 >= s && (r = e, setTimeout(function() {
                        r = null
                    },
                    500))
                }
            } else e = {
                x: o.pageX,
                y: o.pageY,
                target: i
            },
            setTimeout(function() {
                e = null
            },
            400)
        },
        !0), n.addEventListener("touchend",
        function(e) {
            var n = e.target;
            r && n == r.target && t(n).trigger("dblclick", e)
        }))
    },
    o._mouseDown = function(e) {
        var r = this;
        return t(e.target).closest(".pq-editor-focus").length ? (this._blurEditMode = !0, void window.setTimeout(function() {
            r._blurEditMode = !1
        },
        0)) : void 0
    },
    o.destroy = function() {
        this._trigger("destroy"),
        this._super(),
        t(window).off("resize" + this.eventNamespace);
        for (var e in this) delete this[e];
        this.options = void 0,
        t.fragments = {}
    },
    o._setOption = function(t, e) {
        var r = this.options,
        n = function() {
            r[t] = e
        },
        i = this.iRenderB,
        o = this.iRenderSum,
        a = function() {
            return e ? "addClass": "removeClass"
        },
        l = r.dataModel;
        if ("height" === t) n(),
        this._refreshResizable();
        else if ("width" === t) n(),
        this._refreshResizable();
        else if ("title" == t) n(),
        this._refreshTitle();
        else if ("roundCorners" == t) {
            n();
            var s = a();
            this.element[s]("ui-corner-all"),
            this.$top[s]("ui-corner-top"),
            this.$bottom[s]("ui-corner-bottom")
        } else if ("freezeCols" == t) e = parseInt(e),
        !isNaN(e) && e >= 0 && e <= this.colModel.length - 2 && n();
        else if ("freezeRows" == t) e = parseInt(e),
        !isNaN(e) && e >= 0 && n();
        else if ("resizable" == t) n(),
        this._refreshResizable();
        else if ("draggable" == t) n(),
        this._refreshDraggable();
        else if ("dataModel" == t) e.data !== l.data && l.dataUF && (l.dataUF.length = 0),
        n();
        else {
            if ("groupModel" == t) throw "use groupOption() to set groupModel options.";
            if ("treeModel" == t) throw "use treeOption() to set treeModel options.";
            if ("pageModel" == t) n();
            else if ("colModel" === t || "columnTemplate" == t) n(),
            this.iColModel.init();
            else if ("disabled" === t) this._super(t, e),
            e === !0 ? this._disable() : this._enable();
            else if ("strLoading" === t) n(),
            this._refreshLoadingString();
            else if ("showTop" === t) n(),
            this.$top.css("display", e ? "": "none");
            else if ("showTitle" === t) n(),
            this.$title.css("display", e ? "": "none");
            else if ("showToolbar" === t) {
                n();
                var d = this._toolbar.widget();
                d.css("display", e ? "": "none")
            } else "collapsible" === t ? (n(), this._createCollapse()) : "showBottom" === t ? (n(), this.$bottom.css("display", e ? "": "none")) : "rowBorders" === t ? (n(), s = a(), cls = "pq-td-border-top", i.$tbl[s](cls), o.$tbl[s](cls)) : "columnBorders" === t ? (n(), s = a(), cls = "pq-td-border-right", i.$tbl[s](cls), o.$tbl[s](cls)) : n()
        }
        return this
    },
    o.options = {
        cancel: "input,textarea,button,select,option,.pq-no-capture,.ui-resizable-handle",
        trigger: !1,
        bootstrap: {
            on: !1,
            thead: "table table-striped table-condensed table-bordered",
            tbody: "table table-condensed",
            grid: "panel panel-default",
            top: "",
            btn: "btn btn-default",
            groupModel: {
                icon: ["glyphicon-triangle-bottom", "glyphicon-triangle-right"]
            },
            header_active: "active"
        },
        ui: {
            on: !0,
            grid: "ui-widget ui-widget-content",
            top: "ui-widget-header",
            bottom: "ui-widget-header",
            header_o: "ui-widget-header",
            header: "ui-state-default",
            header_active: "ui-state-active"
        },
        collapsible: {
            on: !0,
            toggle: !0,
            collapsed: !1,
            _collapsed: !1,
            refreshAfterExpand: !0,
            css: {
                zIndex: 1e3
            }
        },
        colModel: null,
        columnBorders: !0,
        dataModel: {
            data: [],
            dataUF: [],
            cache: !1,
            dataType: "JSON",
            location: "local",
            sorting: "local",
            sortDir: "up",
            method: "GET"
        },
        direction: "",
        draggable: !1,
        editable: !0,
        editModel: {
            cellBorderWidth: 0,
            pressToEdit: !0,
            clicksToEdit: 2,
            filterKeys: !0,
            keyUpDown: !0,
            reInt: /^([\-]?[1-9][0-9]*|[\-]?[0-9]?)$/,
            reFloat: /^[\-]?[0-9]*\.?[0-9]*$/,
            onBlur: "validate",
            saveKey: t.ui.keyCode.ENTER,
            onSave: "nextFocus",
            onTab: "nextFocus",
            allowInvalid: !1,
            invalidClass: "pq-cell-red-tr pq-has-tooltip",
            warnClass: "pq-cell-blue-tr pq-has-tooltip",
            validate: !0
        },
        editor: {
            select: !1,
            type: "textbox"
        },
        summaryOptions: {
            number: "avg,max,min,stdev,stdevp,sum",
            date: "count,max,min",
            string: "count"
        },
        summaryTitle: {
            avg: "Avg: {0}",
            count: "Count: {0}",
            max: "Max: {0}",
            min: "Min: {0}",
            stdev: "Stdev: {0}",
            stdevp: "Stdevp: {0}",
            sum: "Sum: {0}"
        },
        validation: {
            icon: "ui-icon-alert",
            cls: "ui-state-error",
            style: "padding:3px 10px;"
        },
        warning: {
            icon: "ui-icon-info",
            cls: "",
            style: "padding:3px 10px;"
        },
        freezeCols: 0,
        freezeRows: 0,
        freezeBorders: !0,
        calcDataIndxFromColIndx: !0,
        height: 400,
        hoverMode: "null",
        maxColWidth: 2e3,
        minColWidth: 50,
        minWidth: 100,
        numberCell: {
            width: 30,
            title: "",
            resizable: !0,
            minWidth: 30,
            maxWidth: 100,
            show: !0
        },
        pageModel: {
            curPage: 1,
            totalPages: 0,
            rPP: 20, //      DTS修改
            rPPOptions: [10, 20, 50, 100]
        },
        resizable: !1,
        roundCorners: !0,
        rowBorders: !0,
        autoRow: !0,
        scrollModel: {
            autoFit: !1
        },
        selectionModel: {
            type: "cell",
            onTab: "nextFocus",
            row: !0,
            mode: "block"
        },
        showBottom: !0,
        showHeader: !0,
        showTitle: !0,
        showToolbar: !0,
        showTop: !0,
        sortable: !0,
        sql: !1,
        stripeRows: !0,
        title: "&nbsp;",
        treeModel: null,
        width: "auto",
//      DTS修改
//      wrap: !0,
        wrap: !1,
        hwrap: !0
    };
    var a = {
        strAdd: "Add",
        strDelete: "Delete",
        strEdit: "Edit",
        strGroup_header: "Drag a column here to group by that column",
        strGroup_merge: "Merge cells",
        strGroup_fixCols: "Fix columns",
        strGroup_grandSummary: "Grand summary",
        strLoading: "Loading",
        strNoRows: "No rows to display."
    };
    t.extend(!0, o.options, a),
    t.widget("paramquery._pqGrid", o);
    var l = i._pqGrid.prototype;
    l.refreshCM = function(t) {
        t ? this.option("colModel", t) : this.iColModel.init()
    },
    l.evtBelongs = function(e) {
        return t(e.target).closest(".pq-grid")[0] == this.element[0]
    },
    l.readCell = function(t, e, r, n, i) {
        return r && r.isRootCell(n, i, "o") === !1 ? void 0 : t[e.dataIndx]
    },
    l.saveCell = function(t, e, r) {
        var n = e.dataIndx;
        t[n] = r
    },
    l._destroyResizable = function() {
        var t = this.element,
        e = t.data(); (e.resizable || e.uiResizable || e["ui-resizable"]) && t.resizable("destroy")
    },
    l._disable = function() {
        null == this.$disable && (this.$disable = t("<div class='pq-grid-disable'></div>").css("opacity", .2).appendTo(this.element))
    },
    l._enable = function() {
        this.$disable && (this.element[0].removeChild(this.$disable[0]), this.$disable = null)
    },
    l._destroy = function() {
        this.loading && this.xhr.abort(),
        this._destroyResizable(),
        this._destroyDraggable(),
        this.element.off(this.eventNamespace),
        t(window).unbind(this.eventNamespace),
        t(document).unbind(this.eventNamespace),
        this.element.empty().css("height", "").css("width", "").removeClass("pq-grid ui-widget ui-widget-content ui-corner-all").removeData()
    },
    l.addColumn = function(t) {
        var e = t.columns || [t.column],
        r = this.options,
        n = r.colModel,
        i = n.concat(e);
        this.refreshCM(i),
        this._trigger("addColumn"),
        t.refresh !== !1 && this.refresh()
    },
    l.deleteColumn = function(t) {
        for (var e = t.colList || [{
            colIndx: t.colIndx
        }], r = t.history !== !1, n = this.options, i = n.colModel, o = e.length - 1; o >= 0; o--) {
            var a = e[o],
            l = a.colIndx,
            s = i.splice(l, 1)[0];
            a.column = s
        }
        this.iColModel.init(),
        r && (this.iHistory.increment(), e.type = "delete", this.iHistory.push({
            colList: e
        })),
        this._trigger("deleteColumn", null, {
            colList: e
        }),
        t.refresh !== !1 && this.refreshView()
    },
    l._onKeyUp = function(t) {
        return function(e) {
            t.evtBelongs(e) && t._trigger("keyUp", e, null)
        }
    },
    l.onKeyPressDown = function(e) {
        var r = this,
        n = t(e.target).closest(".pq-header-outer");
        return n.length ? r._trigger("headerKeyDown", e, null) : void(r.iKeyNav.bodyKeyPressDown(e) !== !1 && 0 == r._trigger("keyDown", e, null))
    },
    l._onKeyPressDown = function(t) {
        return function(e) {
            t.evtBelongs(e) && t.onKeyPressDown(e, t)
        }
    },
    l.collapse = function(t) {
        var e = this,
        r = this.element,
        n = this.options,
        i = n.collapsible,
        o = i.$collapse.children("span"),
        a = function() {
            r.css("overflow", "hidden"),
            o.addClass("ui-icon-circle-triangle-s").removeClass("ui-icon-circle-triangle-n"),
            r.hasClass("ui-resizable") && r.resizable("destroy"),
            e._toolbar && e._toolbar.disable(),
            i.collapsed = !0,
            i._collapsed = !0,
            i.animating = !1,
            e._trigger("collapse")
        };
        return t = t ? t: {},
        i._collapsed ? !1 : (i.htCapture = r.height(), void(t.animate === !1 ? (r.height(23), a()) : (i.animating = !0, r.animate({
            height: "23px"
        },
        function() {
            a()
        }))))
    },
    l.expand = function(t) {
        var e = this,
        r = this.element,
        n = this.options,
        i = n.collapsible,
        o = i.htCapture,
        a = i.$collapse.children("span"),
        l = function() {
            r.css("overflow", ""),
            i._collapsed = !1,
            i.collapsed = !1,
            e._refreshResizable(),
            i.refreshAfterExpand && e.refresh(),
            a.addClass("ui-icon-circle-triangle-n").removeClass("ui-icon-circle-triangle-s"),
            e._toolbar && e._toolbar.enable(),
            i.animating = !1,
            e._trigger("expand")
        };
        return t = t ? t: {},
        i._collapsed === !1 ? !1 : void(t.animate === !1 ? (r.height(o), l()) : (i.animating = !0, r.animate({
            height: o
        },
        function() {
            l()
        })))
    },
    l._createCollapse = function() {
        var n = this,
        i = this.$top,
        o = this.options,
        a = this.BS_on,
        l = o.collapsible;
        if (!l.$stripe) {
            var s = t(["<div class='pq-slider-icon pq-no-capture'  >", "</div>"].join("")).appendTo(i);
            l.$stripe = s
        }
        l.on ? l.$collapse || (l.$collapse = t(a ? e("collapse-down") : r("circle-triangle-n")).appendTo(l.$stripe).click(function(t) {
            l.collapsed ? n.expand() : n.collapse()
        })) : l.$collapse && (l.$collapse.remove(), delete l.$collapse),
        l.collapsed && !l._collapsed ? n.collapse({
            animate: !1
        }) : !l.collapsed && l._collapsed && n.expand({
            animate: !1
        }),
        l.toggle ? l.$toggle || (l.$toggle = t(a ? e("fullscreen") : r("arrow-4-diag")).prependTo(l.$stripe).click(function(t) {
            n.toggle()
        })) : l.$toggle && (l.$toggle.remove(), delete l.$toggle)
    },
    l.toggle = function() {
        var e, r = this.options,
        n = r.collapsible,
        i = this.element,
        o = this._maxim,
        e = o ? "min": "max",
        a = t(document.body);
        if (this._trigger("beforeToggle", null, {
            state: e
        }) === !1) return ! 1;
        if ("min" == e) {
            var l = o.eleObj,
            s = o.docObj;
            this.option({
                height: l.height,
                width: l.width,
                maxHeight: l.maxHeight,
                maxWidth: l.maxWidth
            }),
            i[0].style.cssText = l.cssText,
            a[0].style.cssText = s.cssText,
            t("html").css({
                overflow: "visible"
            }),
            window.scrollTo(s.scrollLeft, s.scrollTop),
            this._maxim = null
        } else {
            var l = {
                height: r.height,
                width: r.width,
                cssText: i[0].style.cssText,
                maxHeight: r.maxHeight,
                maxWidth: r.maxWidth
            };
            this.option({
                height: "100%",
                width: "100%",
                maxHeight: null,
                maxWidth: null
            }),
            i.css(t.extend({
                position: "fixed",
                left: 0,
                top: 0,
                margin: 0
            },
            n.css));
            var s = {
                scrollLeft: t(window).scrollLeft(),
                scrollTop: t(window).scrollTop(),
                cssText: a[0].style.cssText
            };
            a.css({
                height: 0,
                width: 0,
                overflow: "hidden",
                position: "static"
            }),
            t("html").css({
                overflow: "hidden"
            }),
            window.scrollTo(0, 0),
            this._maxim = {
                eleObj: l,
                docObj: s
            }
        }
        this._trigger("toggle", null, {
            state: e
        }),
        this._refreshResizable(),
        this.refresh(),
        t(window).trigger("resize", {
            $grid: i,
            state: e
        })
    },
    l._mousePQUp = function(e) {
        t(document).unbind("mouseup" + this.eventNamespace, this._mousePQUpDelegate),
        this._trigger("mousePQUp", e, null)
    },
    l._onDblClickCell = function(e) {
        var r = this,
        n = t(e.currentTarget),
        i = r.getCellIndices({
            $td: n
        }),
        o = i.rowIndx,
        a = i.rowIndxPage,
        l = i.colIndx;
        return i.$td = n,
        0 == r._trigger("cellDblClick", e, i) ? !1 : void(r.options.editModel.clicksToEdit > 1 && this.isEditableRow({
            rowIndx: o
        }) && this.isEditableCell({
            colIndx: l,
            rowIndx: o
        }) && r.editCell({
            rowIndxPage: a,
            colIndx: l
        }))
    },
    l._onClickCont = function(t) {},
    l._onClickRow = function(e) {
        var r = this,
        n = t(e.currentTarget),
        i = r.normalize(r.getRowIndx({
            $tr: n
        }));
        return i.$tr = n,
        0 == r._trigger("rowClick", e, i) ? !1 : void 0
    },
    l._onRightClickRow = function(e) {
        var r = this,
        n = t(e.currentTarget),
        i = r.normalize(r.getRowIndx({
            $tr: n
        }));
        return i.$tr = n,
        0 == r._trigger("rowRightClick", e, i) ? !1 : void 0
    },
    l._onDblClickRow = function(e) {
        var r = this,
        n = t(e.currentTarget),
        i = r.normalize(r.getRowIndx({
            $tr: n
        }));
        return i.$tr = n,
        0 == r._trigger("rowDblClick", e, i) ? !1 : void 0
    },
    l.getValueFromDataType = function(e, r, n) {
        if ("=" == (e + "")[0]) return e;
        var i;
        if ("date" == r) return i = Date.parse(e),
        isNaN(i) ? "": n ? i: e;
        if ("object" == r) return e;
        if ("integer" == r) i = parseInt(e);
        else {
            if ("float" != r) return "bool" == r ? (i = t.trim(e).toLowerCase(), 0 == i.length ? null: "true" == i || "yes" == i || "1" == i ? !0 : "false" == i || "no" == i || "0" == i ? !1 : Boolean(i)) : null == e ? e: t.trim(e);
            i = parseFloat(e)
        }
        return isNaN(i) || null == i ? null == e ? e: null: i
    },
    l.isValid = function(t) {
        return this.iValid.isValid(t)
    },
    l.isValidChange = function(t) {
        t = t || {};
        var e = this.getChanges(),
        r = e.addList,
        n = e.updateList,
        i = n.concat(r);
        return t.data = i,
        this.isValid(t)
    },
    l.isEditableRow = function(t) {
        var e = this.options.editable;
        return null != e ? "function" == typeof e ? e.call(this, this.normalize(t)) : e: !0
    },
    l.isEditableCell = function(t) {
        var e, r, n = t.column;
        return n || (e = this.normalize(t), n = e.column),
        r = n.editable,
        t.checkVisible && n.hidden ? !1 : null != r ? "function" == typeof r ? (e = e || this.normalize(t), this.callFn(r, e)) : r: !0
    },
    l._onMouseDownCont = function(e) {
        this.blurEditor({
            blurIfFocus: !0
        });
        var r, n, i = this;
        return this._mousePQUpDelegate = function(t) {
            return i._mousePQUp(t)
        },
        t(document).bind("mouseup" + this.eventNamespace, this._mousePQUpDelegate),
        r = i.pdata,
        r && r.length || (n = i.$cont[0], n.setAttribute("tabindex", 0), n.focus()),
        !0
    },
    l._onMouseDown = function(e) {
        return function(r) {
            if (1 == r.which && e.evtBelongs(r)) {
                var n, i = t(r.target),
                o = i.closest(".pq-grid-cell,.pq-grid-number-cell:not(.pq-detail-child)");
                if (o.length && (r.currentTarget = o[0], n = e._onMouseDownCell(r), n === !1)) return ! 1;
                if (r.isPropagationStopped()) return;
                var a = i.closest(".pq-grid-row");
                if (a.length && (r.currentTarget = a[0], n = e._onMouseDownRow(r), n === !1)) return ! 1;
                if (r.isPropagationStopped()) return;
                return e._onMouseDownCont(r)
            }
        }
    },
    l._onMouseDownCell = function(e) {
        var r, n = this,
        i = t(e.currentTarget),
        o = n.getCellIndices({
            $td: i
        });
        return null != o.rowIndx ? (r = this.iMerge.getRootCellO(o.rowIndx, o.colIndx, !0), r.$td = i, 0 != n._trigger("cellMouseDown", e, r)) : void 0
    },
    l._onMouseDownRow = function(e) {
        var r = this,
        n = t(e.currentTarget),
        i = r.getRowIndx({
            $tr: n
        });
        return i.$tr = n,
        0 != r._trigger("rowMouseDown", e, i)
    },
    l._onCellMouseEnter = function(e) {
        return function(r) {
            if (e.evtBelongs(r)) {
                var n = t(this),
                i = e.options,
                o = e.getCellIndices({
                    $td: n
                });
                if (null == o.rowIndx || null == o.colIndx) return;
                return e._trigger("cellMouseEnter", r, o) === !1 ? !1 : ("cell" == i.hoverMode && e.highlightCell(n), !0)
            }
        }
    },
    l._onChange = function(e) {
        function r() {
            if (n && i && i.target == n.target) {
                var t, r = {
                    ctrlKey: 0,
                    metaKey: 0,
                    shiftKey: 0,
                    altKey: 0
                };
                for (t in r) i[t] = n[t];
                e._trigger("valChange", i, o),
                i = n = void 0
            }
        }
        var n, i, o;
        return e.on("cellClickDone",
        function(t) {
            n = t.originalEvent,
            r()
        }),
        function(n) {
            if (e.evtBelongs(n)) {
                var a = t(n.target),
                l = a.closest(".pq-grid-cell");
                l.length && (o = e.getCellIndices({
                    $td: l
                }), o = e.normalize(o), o.input = a[0], i = n, r())
            }
        }
    },
    l._onRowMouseEnter = function(e) {
        return function(r) {
            if (e.evtBelongs(r)) {
                var n = t(this),
                i = e.options,
                o = e.getRowIndx({
                    $tr: n
                }),
                a = o.rowIndxPage;
                return e._trigger("rowMouseEnter", r, o) === !1 ? !1 : ("row" == i.hoverMode && e.highlightRow(a), !0)
            }
        }
    },
    l._onCellMouseLeave = function(e) {
        return function(r) {
            if (e.evtBelongs(r)) {
                var n = t(this);
                return "cell" == e.options.hoverMode && e.unHighlightCell(n),
                !0
            }
        }
    },
    l._onRowMouseLeave = function(e) {
        return function(r) {
            if (e.evtBelongs(r)) {
                var n = t(this),
                i = e.getRowIndx({
                    $tr: n
                }),
                o = i.rowIndxPage;
                return e._trigger("rowMouseLeave", r, {
                    $tr: n,
                    rowIndx: i.rowIndx,
                    rowIndxPage: o
                }) === !1 ? !1 : ("row" == e.options.hoverMode && e.unHighlightRow(o), !0)
            }
        }
    },
    l.enableSelection = function() {
        this.element.removeClass("pq-disable-select").off("selectstart" + this.eventNamespace)
    },
    l.disableSelection = function() {
        this.element.addClass("pq-disable-select").on("selectstart" + this.eventNamespace,
        function(e) {
            var r = e.target;
            if (r) {
                var n = t(e.target);
                return n.is("input,textarea,select") ? !0 : n.closest(".pq-native-select").length ? !0 : void e.preventDefault()
            }
        })
    },
    l._onClickCell = function(e) {
        var r = this,
        n = this.options,
        i = n.editModel,
        o = t(e.currentTarget),
        a = r.getCellIndices({
            $td: o
        }),
        l = this.normalize(a),
        s = l.rowIndx,
        d = l.colIndx;
        return l.$td = o,
        l.evt = e,
        0 == r._trigger("beforeCellClick", e, l) ? !1 : (r._trigger("cellClick", e, l), void(null == d || 0 > d || 1 == i.clicksToEdit && this.isEditableRow({
            rowIndx: s
        }) && this.isEditableCell({
            colIndx: d,
            rowIndx: s
        }) && r.editCell(l)))
    },
    l._onRightClickCell = function(e) {
        var r = t(e.currentTarget),
        n = this.getCellIndices({
            $td: r
        });
        return n.$td = r,
        0 == this._trigger("cellRightClick", e, n) ? !1 : void 0
    },
    l.highlightCell = function(t) {
        t.addClass("pq-grid-cell-hover ui-state-hover")
    },
    l.unHighlightCell = function(t) {
        t.removeClass("pq-grid-cell-hover ui-state-hover")
    },
    l.highlightRow = function(t) {
        if (isNaN(t));
        else {
            var e = this.getRow({
                rowIndxPage: t
            });
            e && e.addClass("pq-grid-row-hover ui-state-hover")
        }
    },
    l.unHighlightRow = function(t) {
        if (isNaN(t));
        else {
            var e = this.getRow({
                rowIndxPage: t
            });
            e && e.removeClass("pq-grid-row-hover ui-state-hover")
        }
    },
    l._getCreateEventData = function() {
        return {
            dataModel: this.options.dataModel,
            data: this.pdata,
            colModel: this.options.colModel
        }
    },
    l._initPager = function() {
        var e = this,
        r = e.options,
        n = r.pageModel;
        if (n.type) {
            var i = {
                bootstrap: r.bootstrap,
                change: function(t, r) {
                    e.blurEditor({
                        force: !0
                    });
                    var n = e.options.pageModel;
                    void 0 != r.curPage && (n.prevPage = n.curPage, n.curPage = r.curPage),
                    void 0 != r.rPP && (n.rPP = r.rPP),
                    "remote" == n.type ? e.remoteRequest({
                        callback: function() {
                            e._onDataAvailable({
                                apply: !0,
                                header: !1
                            })
                        }
                    }) : e.refreshView({
                        header: !1,
                        source: "pager"
                    })
                },
                refresh: function(t) {
                    e.refreshDataAndView()
                }
            };
            i = t.extend(i, n),
            this.pagerW = pq.pager(n.appendTo ? n.appendTo: this.$footer, i)
        }
    },
    l.generateLoading = function() {
        this.$loading && this.$loading.remove(),
        this.$loading = t("<div class='pq-loading'></div>").appendTo(this.element),
        t(["<div class='pq-loading-bg'></div><div class='pq-loading-mask ui-state-highlight'><div>", this.options.strLoading, "...</div></div>"].join("")).appendTo(this.$loading),
        this.$loading.find("div.pq-loading-bg").css("opacity", .2)
    },
    l._refreshLoadingString = function() {
        this.$loading.find("div.pq-loading-mask").children("div").html(this.options.strLoading)
    },
    l.showLoading = function() {
        null == this.showLoadingCounter && (this.showLoadingCounter = 0),
        this.showLoadingCounter++,
        this.$loading.show()
    },
    l.hideLoading = function() {
        this.showLoadingCounter > 0 && this.showLoadingCounter--,
        this.showLoadingCounter || this.$loading.hide()
    },
    l.getTotalRows = function() {
        var t = this.options,
        e = t.dataModel,
        r = e.data || [],
        n = e.dataUF || [],
        i = t.pageModel;
        return "remote" == i.location ? i.totalRecords: r.length + n.length
    },
    l.refreshDataFromDataModel = function(t) {
        t = t || {};
        var e, r, n, i, o, a = this,
        l = a.options,
        s = l.dataModel,
        d = l.pageModel,
        c = s.data,
        u = d.type,
        h = a._queueATriggers;
        for (var f in h) {
            var p = h[f];
            delete h[f],
            a._trigger(f, p.evt, p.ui)
        }
        if (a._trigger("beforeRefreshData", null, {}), "local" == u) i = d.totalRecords = c.length,
        d.totalPages = n = Math.ceil(i / d.rPP),
        d.curPage > n && (d.curPage = n),
        n && !d.curPage && (d.curPage = 1),
        e = (d.curPage - 1) * d.rPP,
        e = e >= 0 ? e: 0,
        r = d.curPage * d.rPP,
        r > c.length && (r = c.length),
        a.pdata = c.slice(e, r),
        o = e;
        else if ("remote" == u) {
            d.totalPages = n = Math.ceil(d.totalRecords / d.rPP),
            d.curPage > n && (d.curPage = n),
            n && !d.curPage && (d.curPage = 1);
            var r = d.rPP;
            r > c.length && (r = c.length),
            a.pdata = c.slice(0, r),
            o = d.rPP * (d.curPage - 1)
        } else l.backwardCompat ? a.pdata = c.slice(0) : a.pdata = c;
        a.riOffset = o >= 0 ? o: 0,
        a._trigger("dataReady", null, {
            source: t.source
        })
    },
    l.getQueryStringCRUD = function() {
        return ""
    },
    l.remoteRequest = function(e) {
        this.loading && this.xhr.abort(),
        e = e || {};
        var r = this,
        n = "",
        i = "",
        o = this.options,
        a = !1,
        l = this.colModel,
        s = o.dataModel,
        d = o.sortModel,
        c = o.filterModel,
        u = o.pageModel;
        if ("function" == typeof s.getUrl) {
            var h = {
                colModel: l,
                dataModel: s,
                sortModel: d,
                groupModel: o.groupModel,
                pageModel: u,
                filterModel: c
            },
            f = s.getUrl.call(this, h);
            f && f.url && (n = f.url),
            f && f.data && (i = f.data)
        } else if ("string" == typeof s.url) {
            n = s.url;
            var p = {},
            g = {},
            v = {};
            if ("remote" == d.type) {
                e.initBySort || this.sort({
                    initByRemote: !0
                });
                var m = this.iSort.getQueryStringSort();
                m && (p = {
                    pq_sort: m
                })
            }
            "remote" == u.type && (v = {
                pq_curpage: u.curPage,
                pq_rpp: u.rPP
            });
            var w;
            "local" != c.type && (w = this.iFilterData.getQueryStringFilter(), w && (a = !0, g = {
                pq_filter: w
            }));
            var x = s.postData,
            y = s.postDataOnce;
            x && "function" == typeof x && (x = x.call(this, {
                colModel: l,
                dataModel: s
            })),
            i = t.extend({
                pq_datatype: s.dataType
            },
            g, v, p, x, y);
            // DTS
            if ('POST' == s.method && s.contentType && s.contentType.indexOf('application/json') >= 0 )
            	i = JSON.stringify(i);
        }
        n && (this.loading = !0, this.showLoading(), this.xhr = t.ajax({
            url: n,
            dataType: s.dataType,
            async: null == s.async ? !0 : s.async,
            cache: s.cache,
            contentType: s.contentType,
            type: s.method,
            data: i,
            beforeSend: function(t, e) {
                return "function" == typeof s.beforeSend ? s.beforeSend.call(r, t, e) : void 0
            },
            success: function(t, n, i) {
                r.onRemoteSuccess(t, n, i, a, e)
            },
            error: function(t, e, n) {
                if (r.hideLoading(), r.loading = !1, "function" == typeof s.error) s.error.call(r, t, e, n);
                else if ("abort" != n) throw "Error : " + n
            }
        }))
    },
    l.onRemoteSuccess = function(t, e, r, n, i) {
        var o, a = this,
        l = a.options,
        s = a.colModel,
        d = l.pageModel,
        c = l.dataModel;
        o = "function" == typeof c.getData ? c.getData.call(a, t, e, r) : t,
        c.data = o.data,
        "remote" == d.type && (null != o.curPage && (d.curPage = o.curPage), null != o.totalRecords && (d.totalRecords = o.totalRecords)),
        a.hideLoading(),
        a.loading = !1,
        a._trigger("load", null, {
            dataModel: c,
            colModel: s
        }),
        n && (a._queueATriggers.filter = {
            ui: {}
        }),
        i.callback && i.callback()
    },
    l._refreshTitle = function() {
        this.$title.html(this.options.title)
    },
    l._destroyDraggable = function() {
        var t = this.element,
        e = t.parent(".pq-wrapper");
        e.length && e.data("draggable") && (e.draggable("destroy"), this.$title.removeClass("pq-draggable pq-no-capture"), t.unwrap(".pq-wrapper"))
    },
    l._refreshDraggable = function() {
        var t = this.options,
        e = this.element,
        r = this.$title;
        if (t.draggable) {
            r.addClass("pq-draggable pq-no-capture");
            var n = e.parent(".pq-wrapper");
            n.length || e.wrap("<div class='pq-wrapper' />"),
            e.parent(".pq-wrapper").draggable({
                handle: r
            })
        } else this._destroyDraggable()
    },
    l._refreshResizable = function() {
        var e = this,
        r = this.element,
        n = this.options,
        i = (n.width + "").indexOf("%") > -1,
        o = (n.height + "").indexOf("%") > -1,
        a = "auto" == n.width,
        l = "flex" == n.width,
        s = "flex" == n.height;
        if (!n.resizable || (s || o) && (l || i || a)) this._destroyResizable();
        else {
            var d = "e,s,se";
            s || o ? d = "e": (l || i || a) && (d = "s");
            var c = !0;
            if (r.hasClass("ui-resizable")) {
                var u = r.resizable("option", "handles");
                d == u ? c = !1 : this._destroyResizable()
            }
            c && r.resizable({
                helper: "ui-state-default",
                handles: d,
                minWidth: n.minWidth,
                minHeight: n.minHeight ? n.minHeight: 100,
                delay: 0,
                start: function(e, r) {
                    t(r.helper).css({
                        opacity: .5,
                        background: "#ccc",
                        border: "1px solid steelblue"
                    })
                },
                resize: function(t, e) {},
                stop: function(r, i) {
                    var o = e.element,
                    a = o[0],
                    l = n.width,
                    s = n.height,
                    d = (l + "").indexOf("%") > -1,
                    c = (s + "").indexOf("%") > -1,
                    u = "auto" == l,
                    h = "flex" == l,
                    f = "flex" == s,
                    p = !1;
                    a.style.width = a.offsetWidth + 3 + "px",
                    a.style.height = a.offsetHeight + 3 + "px",
                    c || f || (p = !0, n.height = a.offsetHeight),
                    d || u || h || (p = !0, n.width = a.offsetWidth),
                    e.refresh({
                        soft: !0
                    }),
                    o.css("position", "relative"),
                    p && t(window).trigger("resize")
                }
            })
        }
    },
    l.refresh = function(t) {
        this.iRefresh.refresh(t)
    },
    l.refreshView = function(t) {
        null != this.options.editModel.indices && this.blurEditor({
            force: !0
        }),
        this.refreshDataFromDataModel(t),
        this.refresh(t)
    },
    l._refreshPager = function() {
        var t = this.options,
        e = t.pageModel,
        r = !!e.type,
        n = e.rPP,
        i = e.totalRecords;
        if (r) {
            var o = t.pageModel;
            this.pagerW || this._initPager(),
            this.pagerW.option(o),
            i > n ? this.$bottom.css("display", "") : t.showBottom || this.$bottom.css("display", "none")
        } else this.pagerW && (this.pagerW.destroy(), this.pagerW = null),
        t.showBottom ? this.$bottom.css("display", "") : this.$bottom.css("display", "none")
    },
    l.getInstance = function() {
        return {
            grid: this
        }
    },
    l.refreshDataAndView = function(t) {
        var e = this.options.dataModel;
        if ("remote" == e.location) {
            var r = this;
            this.remoteRequest({
                callback: function() {
                    r._onDataAvailable(t)
                }
            })
        } else this._onDataAvailable(t)
    },
    l.getColIndx = function(t) {
        var e, r, n, i = t.dataIndx,
        o = t.column;
        if (o) r = !0;
        else {
            if (void 0 === i) throw "dataIndx / column NA";
            n = !0
        }
        var a = this.colModel,
        l = a.length;
        if (r) {
            for (var s = 0; l > s; s++) if (a[s] == o) return s
        } else if (e = this.colIndxs[i], null != e) return e;
        return - 1
    },
    l.getColumn = function(t) {
        if (null == t.dataIndx) throw "dataIndx N/A";
        return this.columns[t.dataIndx]
    },
    l._generateCellRowOutline = function() {
        var e = this.options,
        r = e.editModel;
        if (!this.$div_focus) {
            var n = this.element;
            r.inline && (n = this.getCell(r.indices), n.css("padding", 0).empty()),
            this.$div_focus = t(["<div class='pq-editor-outer'>", "<div class='pq-editor-inner'>", "</div>", "</div>"].join("")).appendTo(n);
            var i = t.extend({
                all: !0
            },
            r.indices),
            o = this.getCell(i);
            o.css("height", o[0].offsetHeight),
            o.empty(),
            this.refreshEditorPos()
        }
    },
    l.refreshEditorPos = function() {},
    l._removeEditOutline = function(e) {
        function r(t) {
            t.hasClass("hasDatepicker") && t.datepicker("hide").datepicker("destroy")
        }
        if (this.$div_focus) {
            var n = this.$div_focus.find(".pq-editor-focus");
            if (r(n), n[0] == document.activeElement) {
                var i = this._blurEditMode;
                this._blurEditMode = !0,
                n.blur(),
                this._blurEditMode = i
            }
            this.$div_focus.remove(),
            delete this.$div_focus;
            var o = this.options.editModel,
            a = t.extend({},
            o.indices);
            o.indices = null,
            a.rowData = void 0,
            this.refreshCell(a)
        }
    },
    l.scrollX = function(t, e) {
        var r = this;
        return r.iRenderB.scrollX(t,
        function() {
            e && e.call(r)
        })
    },
    l.scrollY = function(t, e) {
        var r = this;
        return r.iRenderB.scrollY(t,
        function() {
            e && e.call(r)
        })
    },
    l.scrollXY = function(t, e, r) {
        var n = this;
        return n.iRenderB.scrollXY(t, e,
        function() {
            r && r.call(n)
        })
    },
    l.scrollRow = function(t, e) {
        var r = this;
        r.iRenderB.scrollRow(r.normalize(t).rowIndxPage,
        function() {
            e && e.call(r)
        })
    },
    l.scrollColumn = function(t, e) {
        var r = this;
        r.iRenderB.scrollColumn(r.normalize(t).colIndx,
        function() {
            e && e.call(r)
        })
    },
    l.scrollCell = function(t, e) {
        var r = this,
        n = r.normalize(t);
        r.iRenderB.scrollCell(n.rowIndxPage, n.colIndx,
        function() {
            e && e.call(r),
            r._trigger("scrollCell")
        })
    },
    l.blurEditor = function(t) {
        if (this.$div_focus) {
            var e = this.$div_focus.find(".pq-editor-focus");
            if (!t || !t.blurIfFocus) return e.triggerHandler("blur", t);
            document.activeElement == e[0] && e.blur()
        }
    },
    l.Selection = function() {
        return this.iSelection
    },
    l.goToPage = function(t) {
        var e = this.options.pageModel;
        if ("local" == e.type || "remote" == e.type) {
            var r = t.rowIndx,
            n = e.rPP,
            i = null == t.page ? Math.ceil((r + 1) / n) : t.page,
            o = e.curPage;
            i != o && (e.curPage = i, "local" == e.type ? this.refreshView() : this.refreshDataAndView())
        }
    },
    l.setSelection = function(t, e) {
        if (null == t) return this.iSelection.removeAll(),
        this.iRows.removeAll({
            all: !0
        }),
        !0;
        var r = this,
        n = r.pdata,
        i = function() {
            null != a && t.focus !== !1 && r.focus({
                rowIndxPage: a,
                colIndx: null == l ? r.getFirstVisibleCI() : l
            }),
            e && e.call(r)
        };
        n && n.length || i(),
        t = this.normalize(t);
        var o = t.rowIndx,
        a = t.rowIndxPage,
        l = t.colIndx; (null == o || 0 > o || 0 > l || l >= this.colModel.length) && i(),
        this.goToPage(t),
        a = o - this.riOffset,
        r.scrollRow({
            rowIndxPage: a
        },
        function() {
            null == l ? (r.iRows.add({
                rowIndx: o
            }), i()) : r.scrollColumn({
                colIndx: l
            },
            function() {
                r.Range({
                    r1: o,
                    c1: l
                }).select(),
                i()
            })
        })
    },
    l.getColModel = function() {
        return this.colModel
    },
    l.saveEditCell = function(e) {
        var r = this.options,
        n = r.editModel;
        if (!n.indices) return null;
        var i, o = t.extend({},
        n.indices),
        a = e ? e.evt: null,
        l = this.riOffset,
        s = o.colIndx,
        d = o.rowIndxPage,
        c = d + l,
        u = this.colModel,
        h = u[s],
        f = h.dataIndx,
        p = this.pdata,
        g = p[d],
        v = r.dataModel;
        if (null == g) return null;
        if (null != d) {
            var m = this.getEditCellData();
            if (t.isPlainObject(m)) {
                i = {};
                for (var w in m) i[w] = g[w]
            } else i = this.readCell(g, h);
            "<br>" == m && (m = ""),
            null == i && "" === m && (m = null);
            var x = {
                rowIndx: c,
                rowIndxPage: d,
                dataIndx: f,
                column: h,
                newVal: m,
                value: m,
                oldVal: i,
                rowData: g,
                dataModel: v
            };
            if (this._trigger("cellBeforeSave", a, x) === !1) return ! 1;
            var y = {},
            C = !1;
            t.isPlainObject(m) ? (y = m, C = !0) : y[f] = m;
            var _ = this.updateRow({
                row: y,
                rowIndx: c,
                refresh: C,
                silent: !0,
                source: "edit",
                checkEditable: !1
            });
            return _ === !1 ? !1 : (this._trigger("cellSave", a, x), !0)
        }
    },
    l._addInvalid = function(t) {},
    l._digestNewRow = function(t, e, r, n, i, o, a, l, s) {
        var d, c, u, h = this,
        f = h.getValueFromDataType,
        p = h.columns,
        g = h.colIndxs;
        for (d in t) if (c = p[d], u = g[d], c) {
            if (o && null != c.editable && h.isEditableCell({
                rowIndx: r,
                colIndx: u,
                dataIndx: d
            }) === !1) {
                delete t[d],
                e && delete e[d];
                continue
            }
            var v = c.dataType,
            m = f(t[d], v),
            w = e ? e[d] : void 0,
            w = void 0 !== w ? f(w, v) : void 0;
            if (t[d] = m, a && c.validations) if ("edit" == s && l === !1) {
                var x = this.isValid({
                    focusInvalid: !0,
                    dataIndx: d,
                    rowIndx: r,
                    value: m
                });
                if (0 == x.valid && !x.warn) return ! 1
            } else {
                var y = "add" == i ? t: n,
                x = this.iValid.isValidCell({
                    column: c,
                    rowData: y,
                    allowInvalid: l,
                    value: m
                });
                x.valid === !1 && (l !== !1 || x.warn || delete t[d])
            }
            if ("update" == i && m === w) {
                delete t[d],
                delete e[d];
                continue
            }
        }
        return "update" != i ? !0 : pq.isEmpty(t) ? void 0 : !0
    },
    l._digestData = function(t) {
        if (t.rowList) throw "not supported";
        if (b = t.addList = t.addList || [], t.updateList = t.updateList || [], t.deleteList = t.deleteList || [], b.length && b[0].rowData) throw "rd in addList";
        if (this._trigger("beforeValidate", null, t) === !1) return ! 1;
        var e, r, n = this,
        i = n.options,
        o = i.editModel,
        a = i.dataModel,
        l = a.data,
        s = i.colModel,
        d = i.pageModel,
        c = i.historyModel,
        u = null == t.validate ? o.validate: t.validate,
        h = "remote" == d.type,
        f = null == t.allowInvalid ? o.allowInvalid: t.allowInvalid,
        p = i.trackModel,
        g = t.track,
        g = null == g ? null == i.track ? p.on: i.track: g,
        v = null == t.history ? c.on: t.history,
        m = this.iHistory,
        w = this.iUCData,
        x = null == t.checkEditable ? !0 : t.checkEditable,
        y = null == t.checkEditableAdd ? x: t.checkEditableAdd,
        C = t.source,
        _ = n.iRefresh,
        I = this.riOffset,
        b = t.addList,
        q = t.updateList,
        R = t.deleteList,
        D = [],
        M = [];
        for (!l && (l = a.data = []), e = 0, r = q.length; r > e; e++) {
            var T, E = q[e],
            S = E.newRow,
            P = E.rowData,
            k = E.checkEditable,
            A = E.rowIndx,
            H = E.oldRow;
            if (null == k && (k = x), !H) throw "oldRow required while update";
            if (!k || i.editable === !0 || n.isEditableRow({
                rowIndx: A,
                rowData: P
            }) !== !1) {
                if (T = this._digestNewRow(S, H, A, P, "update", k, u, f, C), T === !1) return ! 1;
                T && M.push(E)
            }
        }
        for (e = 0, r = b.length; r > e; e++) {
            var P, H, E = b[e],
            S = E.newRow,
            k = E.checkEditable,
            A = E.rowIndx;
            if (null == k && (k = y), s.forEach(function(t) {
                var e = t.dataIndx;
                S[e] = S[e]
            }), T = this._digestNewRow(S, H, A, P, "add", k, u, f, C), T === !1) return ! 1;
            T && D.push(E)
        }
        return b = t.addList = D,
        q = t.updateList = M,
        b.length || q.length || R.length ? (v && (m.increment(), m.push(t)), n._digestUpdate(q, w, g), b.length && (n._digestAdd(b, w, g, l, d, h, I), _.addRowIndx()), R.length && (n._digestDelete(R, w, g, l, d, h, I), _.addRowIndx()), n._trigger("change", null, t), !0) : "edit" == C ? null: !1
    },
    l._digestUpdate = function(t, e, r) {
        for (var n, i, o, a = 0,
        l = t.length,
        s = this.columns,
        d = this.saveCell; l > a; a++) {
            var c = t[a],
            u = c.newRow,
            h = c.rowData;
            r && e.update({
                rowData: h,
                row: u,
                refresh: !1
            });
            for (o in u) n = s[o],
            i = u[o],
            d(h, n, i)
        }
    },
    l._digestAdd = function(t, e, r, n, i, o, a) {
        for (var l, s, d = 0,
        c = t.length; c > d; d++) {
            var u = t[d],
            h = u.newRow,
            f = u.rowIndx;
            r && e.add({
                rowData: h
            }),
            null == f ? n.push(h) : (s = f - a, l = o ? s: f, n.splice(l, 0, h)),
            u.rowData = h,
            o && i.totalRecords++
        }
    },
    l._digestDelete = function(t, e, r, n, i, o, a) {
        for (var l = 0,
        s = t.length; s > l; l++) {
            var d = t[l],
            c = d.rowData,
            u = this.getRowIndx({
                rowData: c,
                dataUF: !0
            }),
            h = u.uf,
            f = u.rowIndx;
            d.uf = h,
            d.rowIndx = f
        }
        for (t.sort(function(t, e) {
            return e.rowIndx - t.rowIndx
        }), l = 0; s > l; l++) {
            var d = t[l],
            c = d.rowData,
            h = d.uf,
            f = d.rowIndx;
            r && e["delete"]({
                rowIndx: f,
                rowData: c
            });
            var p = f - a,
            g = o ? p: f;
            if (h) DM.dataUF.splice(f, 1);
            else {
                var v = n.splice(g, 1);
                v && v.length && o && i.totalRecords--
            }
        }
    },
    l.cacheRIs = function() {
        var t = this.options.dataModel;
        t.data.forEach(function(t, e) {
            t.pq_ri = e
        }),
        t.dataUF.forEach(function(t, e) {
            t.pq_ri_uf = e
        })
    },
    l.getRI = function(t) {
        return null != t.pq_ri ? t.pq_ri: t.pq_ri_uf
    },
    l.refreshColumn = function(t) {
        var e = this.normalize(t),
        r = this.iRenderB,
        n = r.initV,
        i = r.finalV,
        o = this.options.freezeRows,
        a = e.colIndx,
        l = e.dataIndx,
        s = e.column;
        e.skip = !0;
        for (var d = 0; i >= d; d++) n > d && d >= o && (d = n),
        e.rowIndxPage = d,
        this.refreshCell(e);
        this._trigger("refreshColumn", null, {
            column: s,
            colIndx: a,
            dataIndx: l
        })
    },
    l.refreshCell = function(t) {
        var e = this.normalize(t),
        r = this._focusEle,
        n = e.rowIndxPage,
        i = e.colIndx;
        this.iRenderB.refreshCell(n, i, e.rowData, e.column) && (r && r.rowIndxPage == n && this.focus(), e.skip || this._trigger("refreshCell", null, e))
    },
    l.refreshRow = function(t) {
        if (this.pdata) {
            var e, r = this,
            n = this.normalize(t),
            i = n.rowIndx,
            o = n.rowIndxPage,
            a = n.rowData;
            return a ? (this.iRenderB.refreshRow(o), (e = this._focusEle) && e.rowIndxPage == o && r.focus(), this._trigger("refreshRow", null, {
                rowData: a,
                rowIndx: i,
                rowIndxPage: o
            }), !0) : null
        }
    },
    l.quitEditMode = function(t) {
        if (!this._quitEditMode) {
            var e = this,
            r = !1,
            n = !1,
            i = !1,
            o = this.options,
            a = o.editModel,
            l = a.indices,
            s = void 0;
            e._quitEditMode = !0,
            t && (r = t.old, n = t.silent, i = t.fireOnly, s = t.evt),
            l && (n || r || this._trigger("editorEnd", s, l), i || (this._removeEditOutline(t), a.indices = null)),
            e._quitEditMode = null
        }
    },
    l.getViewPortRowsIndx = function() {
        return {
            beginIndx: this.initV,
            endIndx: this.finalV
        }
    },
    l.getViewPortIndx = function() {
        var t = this.iRenderB;
        return {
            initV: t.initV,
            finalV: t.finalV,
            initH: t.initH,
            finalH: t.finalH
        }
    },
    l.getRIOffset = function() {
        return this.riOffset
    },
    l.getEditCell = function() {
        var t = this.options.editModel;
        if (t.indices) {
            var e = this.getCell(t.indices),
            r = this.$div_focus.children(".pq-editor-inner"),
            n = r.find(".pq-editor-focus");
            return {
                $td: e,
                $cell: r,
                $editor: n
            }
        }
        return {}
    },
    l.editCell = function(t) {
        var e, r, n = this,
        i = n.normalize(t),
        o = n.iMerge,
        a = i.rowIndx,
        l = i.colIndx;
        return o.ismergedCell(a, l) && (e = o.getRootCellO(a, l), e.rowIndx != i.rowIndx || e.colIndx != i.colIndx) ? !1 : void n.scrollCell(i,
        function() {
            return r = n.getCell(i),
            r && r.length ? n._editCell(i) : void 0
        })
    },
    l.getFirstEditableColIndx = function(t) {
        if (null == t.rowIndx) throw "rowIndx NA";
        if (!this.isEditableRow(t)) return - 1;
        for (var e = this.colModel,
        r = 0; r < e.length; r++) if (t.colIndx = r, this.isEditableCell(t) && !e[r].hidden) return r;
        return - 1
    },
    l.editFirstCellInRow = function(t) {
        var e = this.normalize(t),
        r = e.rowIndx,
        n = this.getFirstEditableColIndx({
            rowIndx: r
        }); - 1 != n && this.editCell({
            rowIndx: r,
            colIndx: n
        })
    },
    l._editCell = function(e) {
        var r = this.normalize(e),
        n = this,
        o = r.evt,
        a = r.rowIndxPage,
        l = r.colIndx,
        s = n.pdata;
        if (!s || a >= s.length) return ! 1;
        var n = this,
        d = this.options,
        c = d.editModel,
        u = s[a],
        h = r.rowIndx,
        f = this.colModel,
        p = f[l],
        g = p.dataIndx,
        v = n.readCell(u, p),
        m = {
            rowIndx: h,
            rowIndxPage: a,
            cellData: v,
            rowData: u,
            dataIndx: g,
            colIndx: l,
            column: p
        },
        w = p.editor,
        x = this,
        y = typeof w,
        w = "function" == y || "string" == y ? x.callFn(w, m) : w;
        if (void 0 === w && "function" == typeof d.geditor && (w = d.geditor.call(x, m)), w !== !1) {
            w && w.getData && (c._getData = w.getData);
            var C = d.editor,
            _ = w ? t.extend({},
            C, w) : C,
            I = !1;
            if (c.indices) {
                var b = c.indices;
                if (b.rowIndxPage == a && b.colIndx == l) {
                    this.refreshEditorPos();
                    var q = this.$div_focus.find(".pq-editor-focus");
                    return q[0].focus(),
                    document.activeElement != q[0] && window.setTimeout(function() {
                        q.focus()
                    },
                    0),
                    !1
                }
                if (this.blurEditor({
                    evt: o
                }) === !1) return ! 1;
                this.quitEditMode({
                    evt: o
                })
            }
            c.indices = {
                rowIndxPage: a,
                rowIndx: h,
                colIndx: l,
                column: p,
                dataIndx: g
            },
            this._generateCellRowOutline();
            var R = this.$div_focus,
            D = R.children(".pq-editor-inner");
            D.addClass("pq-align-" + (p.align || "left")),
            m.$cell = D;
            var M, T = _.type,
            E = null == r.select ? _.select: r.select,
            S = _.init,
            P = _.valueIndx,
            k = _.dataMap,
            A = _.mapIndices,
            A = A ? A: {},
            H = _.cls || "",
            H = "function" == typeof H ? H.call(x, m) : H,
            F = "pq-editor-focus " + H,
            $ = F + " pq-cell-editor ",
            L = _.attr || "",
            L = "function" == typeof L ? L.call(x, m) : L,
            V = _.style || "",
            V = "function" == typeof V ? V.call(x, m) : V,
            O = V ? "style='" + V + "'": "",
            N = O,
            z = O;
            if (m.cls = F, m.attr = L, "function" == typeof T && (M = T.call(x, m), M && (T = M)), C._type = T, "checkbox" == T) {
                var B = _.subtype,
                U = v ? "checked='checked'": "";
                M = "<input " + U + " class='" + $ + "' " + L + " " + z + " type=checkbox name='" + g + "' />",
                D.html(M);
                var W = D.children("input");
                "triple" == B && (W.pqval({
                    val: v
                }), D.click(function(e) {
                    t(this).children("input").pqval({
                        incr: !0
                    })
                }))
            } else if ("textarea" == T || "select" == T || "textbox" == T) {
                if ("textarea" == T) M = "<textarea class='" + $ + "' " + L + " " + N + " name='" + g + "' ></textarea>";
                else if ("select" == T) {
                    var j = _.options || [];
                    j.constructor !== Array && (j = n.callFn(j, m));
                    var G = [L, " class='", $, "' ", N, " name='", g, "'"].join("");
                    M = i.select({
                        options: j,
                        attr: G,
                        prepend: _.prepend,
                        labelIndx: _.labelIndx,
                        valueIndx: P,
                        groupIndx: _.groupIndx,
                        dataMap: k
                    })
                } else M = "<input class='" + $ + "' " + L + " " + N + " type=text name='" + g + "' />";
                t(M).appendTo(D).val("select" == T && null != P && (A[P] || this.columns[P]) ? A[P] ? u[A[P]] : u[P] : v)
            } else T && "contenteditable" != T || (M = "<div contenteditable='true' tabindx='0' " + O + " " + L + " class='" + $ + "'></div>", D.html(M), D.children().html(v), I = !0);
            S && (m.$editor = D.children(".pq-editor-focus"), this.callFn(S, m));
            var q = D.children(".pq-editor-focus"),
            K = c.filterKeys,
            Q = p.editModel;
            Q && void 0 !== Q.filterKeys && (K = Q.filterKeys);
            var X = {
                $cell: D,
                $editor: q,
                $td: n.getCell(c.indices),
                dataIndx: g,
                column: p,
                colIndx: l,
                rowIndx: h,
                rowIndxPage: a,
                rowData: u
            };
            if (c.indices = X, q.data({
                FK: K
            }).on("click",
            function(e) {
                t(this).focus(),
                n._trigger("editorClick", null, X)
            }).on("keydown",
            function(t) {
                n.iKeyNav.keyDownInEdit(t)
            }).on("keypress",
            function(t) {
                return n.iKeyNav.keyPressInEdit(t, {
                    FK: K
                })
            }).on("keyup",
            function(t) {
                return n.iKeyNav.keyUpInEdit(t, {
                    FK: K
                })
            }).on("blur",
            function(e, r) {
                var i = n.options,
                o = i.editModel,
                a = o.onBlur,
                l = "save" == a,
                s = "validate" == a,
                d = o.cancelBlurCls,
                c = r ? r.force: !1;
                if (!n._quitEditMode && !n._blurEditMode && o.indices) {
                    var u = t(e.target);
                    if (!c) {
                        if (n._trigger("editorBlur", e, X) === !1) return;
                        if (!a) return;
                        if (d && u.hasClass(d)) return;
                        if (u.hasClass("hasDatepicker")) {
                            var h = u.datepicker("widget");
                            if (h.is(":visible")) return ! 1
                        } else if (u.hasClass("ui-autocomplete-input")) {
                            if (u.autocomplete("widget").is(":visible")) return
                        } else if (u.hasClass("ui-multiselect")) {
                            if (t(".ui-multiselect-menu").is(":visible") || t(document.activeElement).closest(".ui-multiselect-menu").length) return
                        } else if (u.hasClass("pq-select-button") && (t(".pq-select-menu").is(":visible") || t(document.activeElement).closest(".pq-select-menu").length)) return
                    }
                    n._blurEditMode = !0;
                    var f = c || l || !s;
                    if (!n.saveEditCell({
                        evt: e,
                        silent: f
                    }) && !c && s) return n._deleteBlurEditMode(),
                    !1;
                    n.quitEditMode({
                        evt: e
                    }),
                    n._deleteBlurEditMode()
                }
            }).on("focus",
            function(t) {
                n._trigger("editorFocus", t, X)
            }), n._trigger("editorBegin", o, X), q.focus(), window.setTimeout(function() {
                var e = t(document.activeElement);
                if (e.hasClass("pq-editor-focus") === !1) {
                    var r = n.element ? n.element.find(".pq-editor-focus") : t();
                    r.focus()
                }
            }), E) if (I) try {
                var Y = q[0],
                J = document.createRange();
                J.selectNodeContents(Y);
                var Z = window.getSelection();
                Z.removeAllRanges(),
                Z.addRange(J)
            } catch(tt) {} else q.select()
        }
    },
    l._deleteBlurEditMode = function(t) {
        var e = this,
        t = t ? t: {};
        e._blurEditMode && (t.timer ? window.setTimeout(function() {
            delete e._blurEditMode
        },
        0) : delete e._blurEditMode)
    },
    l.getRow = function(t) {
        var e = this.normalize(t),
        r = e.rowIndxPage;
        return this.iRenderB.get$Row(r)
    },
    l.getCell = function(e) {
        var r = this.normalize(e),
        n = r.rowIndxPage,
        i = r.colIndx,
        o = this.iRenderB.getCell(n, i);
        return t(o)
    },
    l.getCellHeader = function(e) {
        var r = this.normalize(e).colIndx,
        n = this.headerCells.length - 1,
        i = this.iRenderHead.getCell(n, r);
        return t(i)
    },
    l.getEditorIndices = function() {
        var e = this.options.editModel.indices;
        return e ? t.extend({},
        e) : null
    },
    l.getEditCellData = function() {
        var e = this.options,
        r = e.editModel,
        n = r.indices;
        if (!n) return null;
        var i, o = n.colIndx,
        a = n.rowIndxPage,
        l = n.rowIndx,
        s = this.colModel[o],
        d = s.editor,
        c = e.editor,
        u = d ? t.extend({},
        c, d) : c,
        h = u.valueIndx,
        f = u.labelIndx,
        p = u.mapIndices,
        p = p ? p: {},
        g = s.dataIndx,
        v = this.$div_focus,
        m = v.children(".pq-editor-inner"),
        w = r._getData || u.getData;
        if (r._getData = void 0, w) i = this.callFn(w, {
            $cell: m,
            rowData: n.rowData,
            dataIndx: g,
            rowIndx: l,
            rowIndxPage: a,
            column: s,
            colIndx: o
        });
        else {
            var x = c._type;
            if ("checkbox" == x) {
                var y = m.children();
                i = "triple" == u.subtype ? y.pqval() : !!y.is(":checked")
            } else if ("contenteditable" == x) i = m.children().html();
            else {
                var C = m.find('*[name="' + g + '"]');
                if (C && C.length) if ("select" == x && null != h) if (p[h] || this.columns[h]) {
                    i = {},
                    i[p[h] ? p[h] : h] = C.val(),
                    i[p[f] ? p[f] : f] = C.find("option:selected").text();
                    var _ = u.dataMap;
                    if (_) {
                        var I = C.find("option:selected").data("map");
                        if (I) for (var b = 0; b < _.length; b++) {
                            var q = _[b];
                            i[p[q] ? p[q] : q] = I[q]
                        }
                    }
                } else i = C.val();
                else i = C.val();
                else {
                    var C = m.find(".pq-editor-focus");
                    C && C.length && (i = C.val())
                }
            }
        }
        return i
    },
    l.getCellIndices = function(t) {
        var e, r = t.$td;
        return null == r || 0 == r.length || r.closest(".pq-grid")[0] != this.element[0] ? {}: (e = this.iRenderB.getCellIndx(r[0]), this.iMerge.getRootCellO(e[0] + this.riOffset, e[1], !0))
    },
    l.getRowsByClass = function(t) {
        var e = this.options,
        r = e.dataModel,
        n = e.pageModel,
        i = "remote" == n.type,
        o = this.riOffset,
        a = r.data,
        l = [];
        if (null == a) return l;
        for (var s = 0,
        d = a.length; d > s; s++) {
            var c = a[s];
            if (c.pq_rowcls && (t.rowData = c, this.hasClass(t))) {
                var u = {
                    rowData: c
                },
                h = i ? s + o: s,
                f = h - o;
                u.rowIndx = h,
                u.rowIndxPage = f,
                l.push(u)
            }
        }
        return l
    },
    l.getCellsByClass = function(t) {
        var e = this,
        r = this.options,
        n = r.dataModel,
        i = r.pageModel,
        o = "remote" == i.type,
        a = this.riOffset,
        l = n.data,
        s = [];
        if (null == l) return s;
        for (var d = 0,
        c = l.length; c > d; d++) {
            var u = l[d],
            h = o ? d + a: d,
            f = u.pq_cellcls;
            if (f) for (var p in f) {
                var g = {
                    rowData: u,
                    rowIndx: h,
                    dataIndx: p,
                    cls: t.cls
                };
                if (e.hasClass(g)) {
                    var v = e.normalize(g);
                    s.push(v)
                }
            }
        }
        return s
    },
    l.data = function(e) {
        var r = e.dataIndx,
        n = e.colIndx,
        r = null != n ? this.colModel[n].dataIndx: r,
        i = e.data,
        o = null == i || "string" == typeof i,
        a = e.rowData || this.getRowData(e);
        if (!a) return {
            data: null
        };
        if (null == r) {
            var l = a.pq_rowdata;
            if (o) {
                var s;
                return null != l && (s = null == i ? l: l[i]),
                {
                    data: s
                }
            }
            var d = t.extend(!0, a.pq_rowdata, i);
            a.pq_rowdata = d
        } else {
            var c = a.pq_celldata;
            if (o) {
                var s;
                if (null != c) {
                    var u = c[r];
                    s = null == i || null == u ? u: u[i]
                }
                return {
                    data: s
                }
            }
            c || (a.pq_celldata = {});
            var d = t.extend(!0, a.pq_celldata[r], i);
            a.pq_celldata[r] = d
        }
    },
    l.attr = function(e) {
        var r = e.rowIndx,
        n = e.dataIndx,
        i = e.colIndx,
        n = null != i ? this.colModel[i].dataIndx: n,
        o = e.attr,
        a = null == o || "string" == typeof o,
        l = this.riOffset,
        s = e.refresh,
        d = e.rowData || this.getRowData(e);
        if (!d) return {
            attr: null
        };
        if (a || s === !1 || null != r || (r = this.getRowIndx({
            rowData: d
        }).rowIndx), null == n) {
            var c = d.pq_rowattr;
            if (a) {
                var u;
                return null != c && (u = null == o ? c: c[o]),
                {
                    attr: u
                }
            }
            var h = t.extend(!0, d.pq_rowattr, o);
            if (d.pq_rowattr = h, s !== !1 && null != r) {
                var f = this.getRow({
                    rowIndxPage: r - l
                });
                if (f) {
                    var p = this.stringifyAttr(h);
                    f.attr(p)
                }
            }
        } else {
            var g = d.pq_cellattr;
            if (a) {
                var u;
                if (null != g) {
                    var v = g[n];
                    u = null == o || null == v ? v: v[o]
                }
                return {
                    attr: u
                }
            }
            g || (d.pq_cellattr = {});
            var h = t.extend(!0, d.pq_cellattr[n], o);
            if (d.pq_cellattr[n] = h, s !== !1 && null != r) {
                var m = this.getCell({
                    rowIndxPage: r - l,
                    dataIndx: n
                });
                if (m) {
                    var p = this.stringifyAttr(h);
                    m.attr(p)
                }
            }
        }
    },
    l.stringifyAttr = function(t) {
        var e = {};
        for (var r in t) {
            var n = t[r];
            if (n) if ("title" == r) n = n.replace(/\"/g, "&quot;"),
            e[r] = n;
            else if ("style" == r && "object" == typeof n) {
                var i, o = [];
                for (var a in n) i = n[a],
                i && o.push(a + ":" + i);
                n = o.join(";") + (o.length ? ";": ""),
                n && (e[r] = n)
            } else "object" == typeof n && (n = JSON.stringify(n)),
            e[r] = n
        }
        return e
    },
    l.removeData = function(e) {
        var r = e.dataIndx,
        n = e.colIndx,
        r = null != n ? this.colModel[n].dataIndx: r,
        i = e.data,
        i = null == i ? [] : i,
        o = "string" == typeof i ? i.split(" ") : i,
        a = o.length,
        l = e.rowData || this.getRowData(e);
        if (l) if (null == r) {
            var s = l.pq_rowdata;
            if (s) {
                if (a) for (var d = 0; a > d; d++) {
                    var c = o[d];
                    delete s[c]
                }
                a && !t.isEmptyObject(s) || delete l.pq_rowdata
            }
        } else {
            var u = l.pq_celldata;
            if (u && u[r]) {
                var h = u[r];
                if (a) for (var d = 0; a > d; d++) {
                    var c = o[d];
                    delete h[c]
                }
                a && !t.isEmptyObject(h) || delete u[r]
            }
        }
    },
    l.removeAttr = function(e) {
        var r = e.rowIndx,
        n = e.dataIndx,
        i = e.colIndx,
        n = null != i ? this.colModel[i].dataIndx: n,
        o = e.attr,
        o = null == o ? [] : o,
        a = "string" == typeof o ? o.split(" ") : o,
        l = a.length,
        s = r - this.riOffset,
        d = e.refresh,
        c = e.rowData || this.getRowData(e);
        if (c) if (d !== !1 && null == r && (r = this.getRowIndx({
            rowData: c
        }).rowIndx), null == n) {
            var u = c.pq_rowattr;
            if (u) {
                if (l) for (var h = 0; l > h; h++) {
                    var f = a[h];
                    delete u[f]
                } else for (var f in u) a.push(f);
                l && !t.isEmptyObject(u) || delete c.pq_rowattr
            }
            if (d !== !1 && null != r && a.length) {
                o = a.join(" ");
                var p = this.getRow({
                    rowIndxPage: s
                });
                p && p.removeAttr(o)
            }
        } else {
            var g = c.pq_cellattr;
            if (g && g[n]) {
                var v = g[n];
                if (l) for (var h = 0; l > h; h++) {
                    var f = a[h];
                    delete v[f]
                } else for (var f in v) a.push(f);
                l && !t.isEmptyObject(v) || delete g[n]
            }
            if (d !== !1 && null != r && a.length) {
                o = a.join(" ");
                var m = this.getCell({
                    rowIndxPage: s,
                    dataIndx: n
                });
                m && m.removeAttr(o)
            }
        }
    },
    l.normalize = function(t, e) {
        var r, n, i, o = {};
        for (i in t) o[i] = t[i];
        var a = o.rowIndx,
        l = o.rowIndxPage,
        s = o.dataIndx,
        d = o.colIndx;
        return null == l && null == a || (r = this.riOffset, a = null == a ? 1 * l + r: a, l = null == l ? 1 * a - r: l, o.rowIndx = a, o.rowIndxPage = l, o.rowData = o.rowData || e && e[a] || this.getRowData(o)),
        null == d && null == s || (n = this.colModel, s = null == s ? n[d] ? n[d].dataIndx: void 0 : s, d = null == d ? this.colIndxs[s] : d, o.column = n[d], o.colIndx = d, o.dataIndx = s),
        o
    },
    l.normalizeList = function(t) {
        var e = this,
        r = e.get_p_data();
        return t.map(function(t) {
            return e.normalize(t, r)
        })
    },
    l.addClass = function(t) {
        var e, r = this.normalize(t),
        n = r.rowIndxPage,
        i = r.dataIndx,
        o = pq.arrayUnique,
        a = r.cls,
        l = r.refresh,
        s = r.rowData;
        if (s) if (l !== !1 && null == n && (n = this.getRowIndx({
            rowData: s
        }).rowIndxPage), null == i) {
            var d = s.pq_rowcls;
            if (e = d ? d + " " + a: a, e = o(e.split(/\s+/)).join(" "), s.pq_rowcls = e, l !== !1 && null != n) {
                var c = this.getRow({
                    rowIndxPage: n
                });
                c && c.addClass(a)
            }
        } else {
            var u = [];
            "function" != typeof i.push ? u.push(i) : u = i;
            var h = s.pq_cellcls;
            h || (h = s.pq_cellcls = {});
            for (var f = 0,
            p = u.length; p > f; f++) {
                i = u[f];
                var g = h[i];
                if (e = g ? g + " " + a: a, e = o(e.split(/\s+/)).join(" "), h[i] = e, l !== !1 && null != n) {
                    var v = this.getCell({
                        rowIndxPage: n,
                        dataIndx: i
                    });
                    v && v.addClass(a)
                }
            }
        }
    },
    l.removeClass = function(t) {
        var e = this.normalize(t),
        r = e.rowIndx,
        n = e.rowData,
        i = e.dataIndx,
        o = e.cls,
        a = e.refresh;
        if (n) {
            var l = n.pq_cellcls,
            s = n.pq_rowcls;
            if (a !== !1 && null == r && (r = this.getRowIndx({
                rowData: n
            }).rowIndx), null == i) {
                if (s && (n.pq_rowcls = this._removeClass(s, o), null != r && a !== !1)) {
                    var d = this.getRow({
                        rowIndx: r
                    });
                    d && d.removeClass(o)
                }
            } else if (l) {
                var c = [];
                "function" != typeof i.push ? c.push(i) : c = i;
                for (var u = 0,
                h = c.length; h > u; u++) {
                    i = c[u];
                    var f = l[i];
                    if (f && (n.pq_cellcls[i] = this._removeClass(f, o), null != r && a !== !1)) {
                        var p = this.getCell({
                            rowIndx: r,
                            dataIndx: i
                        });
                        p && p.removeClass(o)
                    }
                }
            }
        }
    },
    l.hasClass = function(t) {
        var e, r = t.dataIndx,
        n = t.cls,
        i = this.getRowData(t),
        o = new RegExp("\\b" + n + "\\b");
        if (i) {
            if (null == r) return e = i.pq_rowcls,
            !(!e || !o.test(e));
            var a = i.pq_cellcls;
            return !! (a && a[r] && o.test(a[r]))
        }
        return null
    },
    l._removeClass = function(t, e) {
        if (t && e) {
            for (var r = t.split(/\s+/), n = e.split(/\s+/), i = [], o = 0, a = r.length; a > o; o++) {
                for (var l = r[o], s = !1, d = 0, c = n.length; c > d; d++) {
                    var u = n[d];
                    if (l === u) {
                        s = !0;
                        break
                    }
                }
                s || i.push(l)
            }
            return i.length > 1 ? i.join(" ") : 1 === i.length ? i[0] : null
        }
    },
    l.getRowIndx = function(t) {
        var e, r, n, i = t.$tr,
        o = t.rowData,
        a = this.riOffset;
        if (o) {
            if (null != (n = o.pq_ri)) return {
                rowData: o,
                rowIndx: n,
                rowIndxPage: n - a
            };
            var l = this.get_p_data(),
            s = !1,
            d = t.dataUF ? this.options.dataModel.dataUF: null,
            c = !1;
            if (l) for (var u = 0,
            h = l.length; h > u; u++) if (l[u] == o) {
                c = !0;
                break
            }
            if (!c && d) {
                s = !0;
                for (var u = 0,
                h = d.length; h > u; u++) if (d[u] == o) {
                    c = !0;
                    break
                }
            }
            return c ? (e = u - a, r = u, {
                rowIndxPage: s ? void 0 : e,
                uf: s,
                rowIndx: r,
                rowData: o
            }) : {}
        }
        return null == i || 0 == i.length ? {}: (e = this.iRenderB.getRowIndx(i[0])[0], null == e ? {}: {
            rowIndxPage: e,
            rowIndx: e + a
        })
    },
    l.search = function(t) {
        for (var e = this.options,
        r = t.row,
        n = t.first,
        i = e.dataModel,
        o = e.pageModel,
        a = o.type,
        l = [], s = this.riOffset, d = "remote" == a, c = i.data, u = 0, h = c.length; h > u; u++) {
            var f = c[u],
            p = !0;
            for (var g in r) r[g] !== f[g] && (p = !1);
            if (p) {
                var v = d ? u + s: u,
                m = this.normalize({
                    rowIndx: v
                });
                if (l.push(m), n) break
            }
        }
        return l
    },
    l._calcNumHiddenFrozens = function() {
        for (var t = 0,
        e = this.options.freezeCols,
        r = 0; e > r; r++) this.colModel[r].hidden && t++;
        return t
    },
    l._calcNumHiddenUnFrozens = function(t) {
        for (var e = 0,
        r = this.options.freezeCols,
        n = null != t ? t: this.colModel.length, i = r; n > i; i++) this.colModel[i].hidden && e++;
        return e
    },
    l.getFirstVisibleRIP = function(t) {
        for (var e = this.pdata,
        r = t ? this.iRenderB.initV: 0, n = e.length; n > r; r++) if (!e[r].pq_hidden) return r
    },
    l.getLastVisibleRIP = function() {
        for (var t = this.pdata,
        e = t.length - 1; e >= 0; e--) if (!t[e].pq_hidden) return e;
        return null
    },
    l.getFirstVisibleCI = function(t) {
        for (var e = this.colModel,
        r = e.length,
        n = t || 0; r > n; n++) if (!e[n].hidden) return n;
        return null
    },
    l.getLastVisibleCI = function() {
        for (var t = this.colModel,
        e = t.length,
        r = e - 1; r >= 0; r--) if (!t[r].hidden) return r;
        return null
    },
    l.getTotalVisibleColumns = function() {
        for (var t = this.colModel,
        e = t.length,
        r = 0,
        n = 0; e > n; n++) {
            var i = t[n],
            o = i.hidden;
            o || r++
        }
        return r
    },
    l.calcWidthCols = function(t, e, r) {
        var n = 0,
        i = this.options,
        o = 0,
        a = i.numberCell,
        l = this.colModel;
        if ( - 1 == t && (a.show && (n += r ? 1 * a.width: a.outerWidth), t = 0), r) for (var s = t; e > s; s++) {
            var d = l[s];
            if (d && !d.hidden) {
                if (!d._width) throw "assert failed";
                n += d._width + o
            }
        } else for (var s = t; e > s; s++) {
            var d = l[s];
            d && !d.hidden && (n += d.outerWidth)
        }
        return n
    }
} (jQuery),
function(t) {
    var e = t.paramquery.cKeyNav = function(t) {
        this.that = t
    };
    e.prototype = {
        bodyKeyPressDown: function(e) {
            var r, n, i, o, a = this,
            l = this.that,
            s = l.riOffset,
            d = l.options,
            c = d.formulasModel,
            u = l.iMerge,
            h = l._focusEle,
            f = l.colModel,
            p = d.selectionModel,
            g = d.editModel,
            v = document.activeElement,
            m = e.ctrlKey || e.metaKey,
            w = t.ui.keyCode,
            x = e.keyCode;
            if (g.indices) return void l.$div_focus.find(".pq-cell-focus").focus();
            if (o = t(e.target), o.hasClass("pq-grid-cell")) h = l.getCellIndices({
                $td: o
            });
            else if ("pq-grid-excel" != v.id && "pq-body-outer" != v.className) return;
            if (x == w.SPACE && o[0] == l.$cont[0]) return ! 1;
            var y, C, _ = l.normalize(h),
            n = _.rowIndxPage,
            r = _.rowIndx,
            i = _.colIndx,
            I = l.pdata,
            b = _,
            q = !0;
            if (null != r && null != i && null != _.rowData) {
                if (u.ismergedCell(r, i) && (b = u.getRootCellO(r, i), _ = b, n = _.rowIndxPage, r = _.rowIndx, i = _.colIndx, x != w.PAGE_UP && x != w.PAGE_DOWN && x != w.HOME && x != w.END || (y = u.getData(r, i, "proxy_cell")) && (C = y.rowIndx - s, I[C].pq_hidden || (n = C, r = n + s)), f[i].hidden && (i = this.getVisibleColIndx(i))), 0 == l._trigger("beforeCellKeyDown", e, b)) return ! 1;
                if (l._trigger("cellKeyDown", e, b), x == w.LEFT || x == w.RIGHT || x == w.UP || x == w.DOWN || p.onTab && x == w.TAB) {
                    var R = null;
                    x == w.LEFT || x == w.TAB && e.shiftKey ? R = this.incrIndx(n, i, !1) : x == w.RIGHT || x == w.TAB && !e.shiftKey ? R = this.incrIndx(n, i, !0) : x == w.UP ? R = this.decrRowIndx2(n, i) : x == w.DOWN && (R = this.incrRowIndx2(n, i)),
                    R && (r = R.rowIndxPage + s, this.select({
                        rowIndx: r,
                        colIndx: R.colIndx,
                        evt: e
                    }))
                } else if (x == w.PAGE_DOWN || x == w.PAGE_UP) {
                    var D = x == w.PAGE_UP ? "pageUp": "pageDown";
                    l.iRenderB[D](n,
                    function(t) {
                        r = t + s,
                        a.select({
                            rowIndx: r,
                            colIndx: i,
                            evt: e
                        })
                    })
                } else if (x == w.HOME) m ? r = l.getFirstVisibleRIP() + s: i = l.getFirstVisibleCI(),
                this.select({
                    rowIndx: r,
                    colIndx: i,
                    evt: e
                });
                else if (x == w.END) m ? r = l.getLastVisibleRIP() + s: i = l.getLastVisibleCI(),
                this.select({
                    rowIndx: r,
                    colIndx: i,
                    evt: e
                });
                else if (x == w.ENTER) {
                    n = b.rowIndxPage,
                    i = b.colIndx;
                    var M = l.getCell({
                        rowIndxPage: n,
                        colIndx: i
                    });
                    if (M && M.length > 0) {
                        var r = n + s,
                        T = l.isEditableRow({
                            rowIndx: r
                        }),
                        E = l.isEditableCell({
                            rowIndx: r,
                            colIndx: i
                        });
                        if (T && E) l.editCell({
                            rowIndxPage: n,
                            colIndx: i
                        });
                        else {
                            var S = M.find("button");
                            S.length && t(S[0]).click()
                        }
                    }
                } else if (m && "65" == x) {
                    var P = l.iSelection;
                    "row" == p.type && "single" != p.mode ? l.iRows.toggleAll({
                        all: p.all
                    }) : "cell" == p.type && "single" != p.mode && P.selectAll({
                        type: "cell",
                        all: p.all
                    })
                } else g.pressToEdit && (this.isEditKey(x) || c.on && 187 == x) && !m ? 46 == x ? l.clear() : (n = b.rowIndxPage, i = b.colIndx, M = l.getCell({
                    rowIndxPage: n,
                    colIndx: i
                }), M && M.length && (r = n + s, T = l.isEditableRow({
                    rowIndx: r
                }), E = l.isEditableCell({
                    rowIndx: r,
                    colIndx: i
                }), T && E && l.editCell({
                    rowIndxPage: n,
                    colIndx: i,
                    select: !0
                })), q = !1) : q = !1;
                q && e.preventDefault()
            }
        },
        decrRowIndx: function(t, e) {
            for (var r = this.that,
            n = t,
            i = r.pdata,
            e = 1,
            o = 0,
            a = t - 1; a >= 0; a--) {
                var l = i[a].pq_hidden;
                if (!l && (o++, n = a, o == e)) return n
            }
            return n
        },
        decrRowIndx2: function(t, e) {
            var r, n, i = this.that,
            o = i.riOffset,
            a = t + o,
            l = i.iMerge,
            s = i.pdata;
            l.ismergedCell(a, e) && (r = l.getRootCell(a, e), n = l.getData(r.o_ri, r.o_ci, "proxy_cell"), e = n ? n.colIndx: r.v_ci);
            for (var d = t - 1; d >= 0; d--) if (!s[d].pq_hidden) {
                t = d;
                break
            }
            return {
                rowIndxPage: t,
                colIndx: e
            }
        },
        getMergeCell: function(t, e) {
            var r, n, i = this.that,
            o = i.iMerge;
            return o.ismergedCell(t, e) ? (n = o.getRootCellO(t, e), o.setData(n.rowIndx, n.colIndx, {
                proxy_cell: {
                    rowIndx: t,
                    colIndx: e
                }
            }), o.getRootCellV(t, e)) : (r || (t = this.getVisibleRowIndx(t), e = this.getVisibleColIndx(e), r = i.normalize({
                rowIndx: t,
                colIndx: e
            })), r)
        },
        getValText: function(e) {
            var r = e[0].nodeName.toLowerCase(),
            n = ["input", "textarea", "select"],
            i = "text";
            return - 1 != t.inArray(r, n) && (i = "val"),
            i
        },
        getVisibleRowIndx: function(t) {
            for (var e = this.that,
            r = e.pdata,
            n = r.length,
            i = e.riOffset,
            o = t - i,
            a = r[o]; a.pq_hidden && n - 1 > o;) o++,
            t++,
            a = r[o];
            return t
        },
        getVisibleColIndx: function(t) {
            for (var e = this.that,
            r = e.colModel,
            n = r.length,
            i = r[t]; i && i.hidden && n - 1 > t;) t++,
            i = r[t];
            return t
        },
        incrEditIndx: function(t, e, r) {
            var n, i = this.that,
            o = i.colModel,
            a = o.length,
            l = i.iMerge,
            s = i.riOffset,
            d = i[r ? "getLastVisibleRIP": "getFirstVisibleRIP"]();
            do {
                var c = t + s,
                u = l.ismergedCell(c, e);
                if (u) {
                    var h = l.getData(c, e, "proxy_edit_cell");
                    h && (c = h.rowIndx, t = c - s),
                    e = r ? e + u.o_cc: e - 1
                } else e = r ? e + 1 : e - 1;
                if (r && e >= a || !r && 0 > e) {
                    if (t == d) return null;
                    do {
                        t = this[r ? "incrRowIndx": "decrRowIndx"](t);
                        var f = i.isEditableRow({
                            rowIndxPage: t
                        });
                        if (t == d && 0 == f) return null
                    } while ( 0 == f );
                    e = r ? 0 : a - 1
                }
                if (c = t + s, u = l.ismergedCell(c, e)) {
                    var p = l.getRootCellO(c, e);
                    l.setData(p.rowIndx, p.colIndx, {
                        proxy_edit_cell: {
                            rowIndx: c,
                            colIndx: e
                        }
                    }),
                    c = p.rowIndx,
                    e = p.colIndx
                }
                n = o[e];
                var g = i.isEditableCell({
                    rowIndx: c,
                    colIndx: e,
                    checkVisible: !0
                }), v = n.editor, v = "function" == typeof v ? v.call(i, i.normalize({
                    rowIndx: c,
                    colIndx: e
                })) : v;
                t = c - s
            } while ( n && ( n . hidden || 0 == g || v === ! 1 ));
            return {
                rowIndxPage: t,
                colIndx: e
            }
        },
        incrIndx: function(t, e, r) {
            var n, i, o, a, l, s = this.that,
            d = s.iMerge,
            c = s.pdata,
            u = s.riOffset,
            h = s[r ? "getLastVisibleRIP": "getFirstVisibleRIP"](),
            f = s.colModel,
            p = f.length;
            if (null == e) return t == h ? null: (t = this[r ? "incrRowIndx": "decrRowIndx"](t), {
                rowIndxPage: t
            });
            do o = t + u,
            d.ismergedCell(o, e) && (n = d.getRootCell(o, e), !l && (i = d.getData(n.o_ri, n.o_ci, "proxy_cell")) && (a = i.rowIndx - u, c[a].pq_hidden || (t = a)), c[t].pq_hidden && (t = d.getRootCellV(o, e).rowIndxPage), !l && r && (e = n.o_ci + (n.o_cc ? n.o_cc - 1 : 0))),
            r ? p - 1 > e && e++:e > 0 && e--,
            l = f[e];
            while (l && l.hidden);
            return {
                rowIndxPage: t,
                colIndx: e
            }
        },
        incrRowIndx: function(t, e) {
            for (var r = this.that,
            n = t,
            e = 1,
            i = r.pdata,
            o = 0,
            a = t + 1,
            l = i.length; l > a; a++) {
                var s = i[a].pq_hidden;
                if (!s && (o++, n = a, o == e)) return n
            }
            return n
        },
        incrRowIndx2: function(t, e) {
            var r, n, i = this.that,
            o = i.riOffset,
            a = t + o,
            l = i.iMerge,
            s = i.pdata;
            l.ismergedCell(a, e) && (r = l.getRootCell(a, e), n = l.getData(r.o_ri, r.o_ci, "proxy_cell"), t = r.o_ri - o + r.o_rc - 1, e = n ? n.colIndx: r.v_ci);
            for (var d = t + 1,
            c = s.length; c > d; d++) {
                var u = s[d].pq_hidden;
                if (!u) {
                    t = d;
                    break
                }
            }
            return {
                rowIndxPage: t,
                colIndx: e
            }
        },
        isEditKey: function(t) {
            return t >= 32 && 127 >= t || 189 == t
        },
        keyDownInEdit: function(e) {
            var r = this.that,
            n = r.options,
            i = n.editModel.indices;
            if (i) {
                var o = t(e.target),
                a = t.ui.keyCode,
                l = n.editModel,
                s = t.extend({},
                i),
                d = s.rowIndxPage,
                c = s.colIndx,
                u = s.column,
                h = u.editModel,
                f = h ? t.extend({},
                l, h) : l,
                p = this.getValText(o);
                if (o.data("oldVal", o[p]()), 0 == r._trigger("editorKeyDown", e, s)) return ! 1;
                if (e.keyCode == a.TAB || e.keyCode == f.saveKey) {
                    var g = e.keyCode == a.TAB ? f.onTab: f.onSave,
                    s = {
                        rowIndxPage: d,
                        colIndx: c,
                        incr: !!g,
                        edit: "nextEdit" == g
                    };
                    return this.saveAndMove(s, e)
                }
                if (e.keyCode == a.ESCAPE) return r.quitEditMode({
                    evt: e
                }),
                r.focus({
                    rowIndxPage: d,
                    colIndx: c
                }),
                e.preventDefault(),
                !1;
                if (e.keyCode == a.PAGE_UP || e.keyCode == a.PAGE_DOWN) return e.preventDefault(),
                !1;
                if (f.keyUpDown && !e.altKey) {
                    if (e.keyCode == a.DOWN) {
                        var s = this.incrRowIndx2(d, c);
                        return this.saveAndMove(s, e)
                    }
                    if (e.keyCode == a.UP) {
                        var s = this.decrRowIndx2(d, c);
                        return this.saveAndMove(s, e)
                    }
                }
            }
        },
        keyPressInEdit: function(e, r) {
            var n = this.that,
            i = n.options,
            o = i.editModel.indices,
            a = r || {},
            l = a.FK,
            s = o.column,
            d = t.ui.keyCode,
            c = ["BACKSPACE", "LEFT", "RIGHT", "UP", "DOWN", "DELETE", "HOME", "END"].map(function(t) {
                return d[t]
            }),
            u = s.dataType;
            if (t.inArray(e.keyCode, c) >= 0) return ! 0;
            if (n._trigger("editorKeyPress", e, t.extend({},
            o)) === !1) return ! 1;
            if (l && ("float" == u || "integer" == u)) {
                var h = o.$editor.val(),
                f = "float" == u ? "0123456789.-=": "0123456789-=",
                p = e.charCode || e.keyCode,
                g = String.fromCharCode(p);
                if ("=" !== h[0] && g && -1 == f.indexOf(g)) return ! 1
            }
            return ! 0
        },
        keyUpInEdit: function(e, r) {
            var n = this.that,
            i = n.options,
            o = r || {},
            a = o.FK,
            l = i.editModel,
            s = l.indices;
            n._trigger("editorKeyUp", e, t.extend({},
            s));
            var d = s.column,
            c = d.dataType;
            if (a && ("float" == c || "integer" == c)) {
                var u = t(e.target),
                h = "integer" == c ? l.reInt: l.reFloat,
                f = this.getValText(u),
                p = u.data("oldVal"),
                g = u[f]();
                if (0 == h.test(g) && "=" !== g[0]) if (h.test(p)) u[f](p);
                else {
                    var v = "float" == c ? parseFloat(p) : parseInt(p);
                    isNaN(v) ? u[f](0) : u[f](v)
                }
            }
        },
        saveAndMove: function(t, e) {
            if (null == t) return e.preventDefault(),
            !1;
            var r = this.that,
            n = t.rowIndxPage,
            i = t.colIndx;
            if (r._blurEditMode = !0, r.saveEditCell({
                evt: e
            }) === !1 || !r.pdata) return r.pdata || r.quitEditMode(e),
            r._deleteBlurEditMode({
                timer: !0,
                msg: "saveAndMove saveEditCell"
            }),
            e.preventDefault(),
            !1;
            if (r.quitEditMode(e), t.incr) {
                var o = this[t.edit ? "incrEditIndx": "incrIndx"](n, i, !e.shiftKey);
                n = o ? o.rowIndxPage: n,
                i = o ? o.colIndx: i
            }
            r.scrollRow({
                rowIndxPage: n
            }),
            r.scrollColumn({
                colIndx: i
            });
            var a = n + r.riOffset;
            return this.select({
                rowIndx: a,
                colIndx: i,
                evt: e
            }),
            t.edit && r._editCell({
                rowIndxPage: n,
                colIndx: i
            }),
            r._deleteBlurEditMode({
                timer: !0,
                msg: "saveAndMove"
            }),
            e.preventDefault(),
            !1
        },
        select: function(e) {
            var r = this,
            n = r.that,
            i = e.rowIndx,
            o = e.colIndx,
            a = i - n.riOffset,
            l = e.evt,
            s = (r.getMergeCell(i, o), n.options),
            d = n.iSelection,
            c = s.selectionModel,
            u = c.type,
            h = "row" == u,
            f = "cell" == u;
            n.scrollCell({
                rowIndx: i,
                colIndx: o
            },
            function() {
                var e = d.address();
                if (l.shiftKey && l.keyCode !== t.ui.keyCode.TAB && c.type && "single" != c.mode && (e.length || h)) if (h) n.iRows.extend({
                    rowIndx: i,
                    evt: l
                });
                else {
                    var r = e[e.length - 1],
                    s = r.firstR,
                    u = r.firstC,
                    p = r.type,
                    g = !1;
                    "column" == p ? (r.c1 = u, r.c2 = o, r.r1 = r.r2 = r.type = void 0) : (e = {
                        _type: "block",
                        r1: s,
                        r2: i,
                        c1: u,
                        c2: o,
                        firstR: s,
                        firstC: u
                    },
                    g = !0),
                    n.Range(e, g).select()
                } else h || f && n.Range({
                    r1: i,
                    c1: o,
                    firstR: i,
                    firstC: o
                }).select();
                n.focus({
                    rowIndxPage: a,
                    colIndx: o
                })
            })
        }
    }
} (jQuery),
function(t) {
    var e = t.paramquery,
    r = e.cGenerateView = function(t) {};
    r.prototype = {
        autoFitCols: function() {
            var t = this.that,
            e = t.colModel,
            r = e.length,
            n = this.dims,
            i = t.calcWidthCols( - 1, r, !0),
            o = this.getSBWd(),
            a = n.wdCenter - o;
            if (i !== a) {
                for (var l, s = i - a,
                d = [], c = 0; r > c; c++) {
                    var u = e[c],
                    h = u._percent,
                    f = (u.resizable !== !1, u._resized),
                    p = u.hidden;
                    if (!p && !h && !f) {
                        var g;
                        0 > s ? (g = u._maxWidth - u._width, g && d.push({
                            availWd: -1 * g,
                            colIndx: c
                        })) : (g = u._width - u._minWidth, g && d.push({
                            availWd: g,
                            colIndx: c
                        }))
                    }
                    f && (l = u, delete u._resized)
                }
                d.sort(function(t, e) {
                    return t.availWd > e.availWd ? 1 : t.availWd < e.availWd ? -1 : 0
                });
                for (var c = 0,
                v = d.length; v > c; c++) {
                    var m, w = d[c],
                    g = w.availWd,
                    x = w.colIndx,
                    y = Math.round(s / (v - c)),
                    u = e[x],
                    C = u._width;
                    Math.abs(g) > Math.abs(y) ? (m = C - y, s -= y) : (m = C - g, s -= g),
                    u.width = u._width = m
                }
                if (0 != s && l) {
                    var m = l._width - s;
                    m > l._maxWidth ? m = l._maxWidth: m < l._minWidth && (m = l._minWidth),
                    l.width = l._width = m
                }
            }
        },
        computeOuterWidths: function() {
            for (var t = this.that,
            e = t.options,
            r = 0,
            n = e.numberCell,
            i = t.colModel,
            o = i.length,
            a = 0; o > a; a++) {
                var l = i[a];
                l.outerWidth = l._width + r
            }
            n.show && (n.outerWidth = n.width)
        },
        numericVal: function(t, e) {
            var r;
            return r = (t + "").indexOf("%") > -1 ? parseInt(t) * e / 100 : parseInt(t),
            Math.round(r)
        },
        refreshColumnWidths: function(t) {
            t = t || {};
            var e = this.that,
            r = e.options,
            n = r.numberCell,
            i = "flex" === r.width,
            o = 0,
            a = e.colModel,
            l = this.autoFit,
            s = this.dims.wdCenter,
            d = a.length,
            c = 0,
            u = r.minColWidth,
            h = r.maxColWidth,
            f = 0;
            n.show && (n.width < n.minWidth && (n.width = n.minWidth), f = n.outerWidth = n.width);
            var p = i ? null: s - c - f,
            u = Math.floor(this.numericVal(u, p)),
            h = Math.ceil(this.numericVal(h, p)),
            g = 0;
            if (!i && 5 > p || isNaN(p)) {
                if (r.debug) throw "availWidth N/A"
            } else {
                delete e.percentColumn;
                for (var v = 0; d > v; v++) {
                    var m = a[v],
                    w = m.hidden;
                    if (!w) {
                        var x = m.width,
                        y = (x + "").indexOf("%") > -1 ? !0 : null,
                        C = m.minWidth,
                        _ = m.maxWidth,
                        C = C ? this.numericVal(C, p) : u,
                        _ = _ ? this.numericVal(_, p) : h;
                        if (C > _ && (_ = C), void 0 != x) {
                            var I, b = 0; ! i && y ? (e.percentColumn = !0, m.resizable = !1, m._percent = !0, I = this.numericVal(x, p) - o, b = Math.floor(I), g += I - b, g >= 1 && (b += 1, g -= 1)) : x && (b = 1 * x),
                            C > b ? b = C: !i && b > _ && (b = _),
                            m._width = b
                        } else m._width = C;
                        y || (m.width = m._width),
                        m._minWidth = C,
                        m._maxWidth = i ? 1e3: _
                    }
                }
                i === !1 && t.refreshWidth !== !1 && l && this.autoFitCols(),
                this.computeOuterWidths()
            }
        },
        format: function() {
            var e = t.datepicker,
            r = pq.formatNumber;
            return function(t, n) {
                if (pq.isDateFormat(n)) {
                    if (t == parseInt(t)) return pq.formulas.TEXT(t, pq.juiToExcel(n));
                    if (isNaN(Date.parse(t))) return;
                    return e.formatDate(n, new Date(t))
                }
                return t == parseFloat(t) ? r(t, n) : void 0
            }
        } (),
        renderCell: function(t) {
            var e, r, n, i, o = this.that,
            a = t.attr || [],
            l = t.style || [],
            s = t.Export,
            d = o.options,
            c = t.cls || [],
            u = t.rowData,
            h = t.column,
            f = h.dataType,
            p = t.colIndx,
            g = h.dataIndx,
            v = d.freezeCols,
            m = d.columnBorders;
            if (u) {
                s || (h.align && c.push("pq-align-" + h.align), p == v - 1 && m && c.push("pq-last-frozen-col"), h.cls && c.push(h.cls));
                var w, x, y = u[g],
                y = "string" == typeof y && "html" != f ? pq.escapeHtml(y) : y,
                C = h.format || (x = u.pq_format) && (x = x[g]),
                _ = C ? this.format(y, C, f) : y;
                if (t.dataIndx = g, t.cellData = y, t.formatVal = _, (i = h.render) && (w = o.callFn(i, t), w && "string" != typeof w && ((e = w.attr) && a.push(e), (n = w.cls) && c.push(n), (r = w.style) && l.push(r), w = w.text)), null == w && (i = h._render) && (w = i.call(o, t)), w && "string" != typeof w && ((e = w.attr) && a.push(e), (n = w.cls) && c.push(n), (r = w.style) && l.push(r), w = w.text), null == w && (w = _ || y), s) return [w, r];
                var I = u.pq_cellcls;
                if (I) {
                    var b = I[g];
                    b && c.push(b)
                }
                var q = u.pq_cellattr;
                if (q) {
                    var R = q[g];
                    if (R) {
                        var D = o.stringifyAttr(R);
                        for (var M in D) {
                            var T = D[M];
                            "style" == M ? l.push(T) : a.push(M + '="' + T + '"')
                        }
                    }
                }
                l = l.length ? " style='" + l.join("") + "' ": "",
                "" !== w && void 0 != w || (w = "&nbsp;"),
                w = pq.newLine(w);
                var E = ["<div class='", c.join(" "), "' ", a.join(" "), l, " >", w, "</div>"].join("");
                return E
            }
        }
    }
} (jQuery),
function(t) {
    var e = t.paramquery,
    r = e._pqGrid.prototype;
    r.getHeadCell = function(t) {
        var e, r, n, i = this.iRenderHead.getCellIndx(t[0]),
        o = i[0],
        a = i[1];
        return null != a && null != o && (r = this.headerCells[o], r && (r = r[a]), r && (n = r.colModel)),
        n && n.length && (e = !0),
        {
            col: r,
            ci: a,
            ri: o,
            isParent: e
        }
    },
    r.flex = function(t) {
        this.iResizeColumns.flex(t)
    },
    e.cHeader = function(t, e) {},
    e.cHeader.prototype = {
        onBeforeRefreshH: function(e, r) {
            return function() {
                var n = document.activeElement,
                i = n ? n.className: "",
                o = e.focusUI,
                a = t(n);
                o && (o.nofocus = -1 == i.indexOf("pq-grid-col-leaf") || !a.closest(r.element).length)
            }
        },
        onRefreshH: function(t) {
            return function(e) {
                t.setTimer(function() {
                    t.that.options && t.focus()
                },
                100)
            }
        },
        colCollapse: function(t, e) {
            var r = this.that,
            n = {
                column: t
            },
            i = t.collapsible;
            r._trigger("beforeColumnCollapse", e, n) !== !1 && (i.on = !i.on, r._trigger("columnCollapse", e, n) !== !1 && r.refresh({
                colModel: !0
            }))
        },
        onKeyDown: function(e, r) {
            var n = t.ui.keyCode;
            return function(i) {
                var o, a, l, s, d = i.originalEvent.target,
                c = t(d).closest(".pq-grid-col-leaf"),
                u = i.keyCode;
                c.length && (a = r.getHeadCell(c), l = a.ci, u == n.RIGHT ? s = e.getNextVisibleCI(l) : u == n.LEFT ? s = e.getPrevVisibleCI(l) : u == n.ENTER && e.onHeaderCellClick(a.col, l, i), null != s && s != l && (c.removeAttr("tabindex"), o = {
                    colIndx: s
                },
                r.scrollColumn(o), e.focus(o)))
            }
        },
        getNextVisibleCI: function(t) {
            for (var e = this.that.colModel,
            r = e.length,
            n = t + 1; r > n; n++) if (!e[n].hidden) return n;
            return t
        },
        getPrevVisibleCI: function(t) {
            for (var e = this.that.colModel,
            r = t - 1; r >= 0; r--) if (!e[r].hidden) return r;
            return t
        },
        onHeaderClick: function(e) {
            var r, n, i, o, a = this,
            l = this.that,
            s = l.iDragColumns;
            if (!s || "stop" == s.status) {
                if (o = t(e.target), o.is("input,label")) return ! 0;
                if (r = o.closest(".pq-grid-col"), r.length && (i = l.getHeadCell(r), n = i.col)) if (o.hasClass("pq-col-collapse")) a.colCollapse(n, e);
                else if (!i.isParent) return a.onHeaderCellClick(n, i.ci, e)
            }
        },
        getTitle: function(t, e) {
            var r = t.title;
            return "function" == typeof r ? r.call(this.that, {
                column: t,
                colIndx: e,
                dataIndx: t.dataIndx
            }) : r
        },
        createHeaderCell: function(t, e, r, n, i, o) {
            var a, l, s, d = this.that,
            c = d.options,
            u = this.getSortSpaceSpans(c.sortModel),
            h = r.collapsible,
            f = "",
            p = r.halign || r.align,
            g = r.cls,
            v = r.type,
            m = this.getTitle(r, e),
            m = null != m ? m: "checkbox" == v && r.cb.header ? "<input type='checkbox'/>": r.dataIndx;
            return r.pqtitle = m,
            p && i.push("pq-align-" + p),
            g && i.push(g),
            null == r.colModel || 0 == r.colModel.length ? i.push("pq-grid-col-leaf") : h && (i.push("pq-collapsible-th"), a = ["<div class='pq-col-collapse'>", h.on ? "+": "-", "</div>"].join("")),
            l = "pq-row-indx=" + t,
            s = "pq-col-indx=" + e,
            ["<div ", s, " ", l, " ", f, " ", n, " ", " class='", i.join(" "), "' style='", o.join(""), "' >", "<div class='pq-td-div'>", m, u, "</div>", a, "</div>"].join("")
        },
        getSortSpaceSpans: function(t) {
            var e = t.space ? " pq-space": "";
            return ["<span class='pq-col-sort-icon", e, "'></span>", t.number ? "<span class='pq-col-sort-count" + e + "'></span>": ""].join("")
        },
        onHeaderCellClick: function(t, e, r) {
            var n = this.that,
            i = n.options,
            o = i.sortModel,
            a = t.dataIndx;
            if (n._trigger("headerCellClick", r, {
                column: t,
                colIndx: e,
                dataIndx: a
            }) !== !1) if (i.selectionModel.column && -1 == r.target.className.indexOf("pq-td-div")) {
                var l = {
                    c1: e,
                    firstC: e
                },
                s = n.iSelection.address();
                if (r.shiftKey) {
                    var d = s.length;
                    if (d && "column" == s[d - 1].type) {
                        var c = s[d - 1];
                        c.c1 = c.firstC,
                        c.c2 = e,
                        c.r1 = c.r2 = c.type = void 0
                    }
                    l = s
                }
                n.Range(l, !1).select(),
                n.focus({
                    rowIndxPage: n.getFirstVisibleRIP(!0),
                    colIndx: e
                })
            } else if (o.on) {
                if (0 == t.sortable) return;
                n.sort({
                    sorter: [{
                        dataIndx: a,
                        sortIndx: t.sortIndx
                    }],
                    addon: !0,
                    tempMultiple: o.multiKey && r[o.multiKey],
                    evt: r
                })
            }
        },
        refreshHeaderSortIcons: function() {
            var e = this.that,
            r = e.options,
            n = r.bootstrap,
            i = r.ui,
            o = e.headerCells.length - 1,
            a = e.$header;
            if (a) {
                var l = e.iSort.getSorter(),
                s = l.length,
                d = !1,
                c = e.options.sortModel;
                c.number && s > 1 && (d = !0);
                for (var u = 0; s > u; u++) {
                    var h = l[u],
                    f = h.dataIndx,
                    p = e.getColIndx({
                        dataIndx: f
                    }),
                    g = h.dir,
                    v = n.on ? n.header_active: i.header_active + " pq-col-sort-" + ("up" == g ? "asc": "desc"),
                    m = n.on ? " glyphicon glyphicon-arrow-" + g: "ui-icon ui-icon-triangle-1-" + ("up" == g ? "n": "s"),
                    w = t(e.iRenderHead.getCell(o, p));
                    w.addClass(v),
                    w.find(".pq-col-sort-icon").addClass(m),
                    d && w.find(".pq-col-sort-count").html(u + 1)
                }
            }
        }
    },
    e.cResizeColumns = function(e) {
        this.that = e;
        var r = this;
        e.$header.mouse(),
        e.$header.on({
            mousedown: function(e) {
                if (!e.pq_composed) {
                    var n = t(e.target);
                    r.setDraggables(e),
                    e.pq_composed = !0;
                    var i = t.Event("mousedown", e);
                    n.trigger(i)
                }
            },
            dblclick: function(t) {
                r.doubleClick(t)
            }
        },
        ".pq-grid-col-resize-handle");
        var n = e.options,
        i = n.flex;
        i.on && i.one && e.one("ready",
        function() {
            r.flex()
        })
    },
    e.cResizeColumns.prototype = {
        doubleClick: function(e) {
            var r = this.that,
            n = r.options,
            i = n.flex,
            o = t(e.target),
            a = parseInt(o.attr("pq-col-indx"));
            isNaN(a) || i.on && this.flex(i.all && !n.scrollModel.autoFit ? null: a)
        },
        flex: function(t) {
            this.that.iRenderB.flex(t)
        },
        setDraggables: function(e) {
            var r, n, i, o = t(e.target),
            a = this;
            o.draggable({
                axis: "x",
                helper: function(e, r) {
                    var n = t(e.target),
                    i = parseInt(n.attr("pq-col-indx"));
                    return a._setDragLimits(i),
                    a._getDragHelper(e, r),
                    n
                },
                start: function(t, e) {
                    r = t.clientX,
                    i = parseInt(a.$cl[0].style.left)
                },
                drag: function(t, e) {
                    n = t.clientX;
                    var o = n - r;
                    a.$cl[0].style.left = i + o + "px"
                },
                stop: function(t, e) {
                    return a.resizeStop(t, e, r)
                }
            })
        },
        _getDragHelper: function(e) {
            var r = this.that,
            n = r.options,
            i = (1 * n.freezeCols, t(e.target)),
            o = r.$grid_center,
            a = r.iRenderHead,
            l = a.scrollX(),
            s = 1 * i.attr("pq-col-indx"),
            d = o.outerHeight(),
            c = a.getLeft(s) - l,
            u = a.getLeft(s + 1) - l,
            h = "style='height:" + d + "px;left:";
            this.$clleft = t("<div class='pq-grid-drag-bar' " + h + c + "px;'></div>").appendTo(o),
            this.$cl = t("<div class='pq-grid-drag-bar' " + h + u + "px;'></div>").appendTo(o)
        },
        _setDragLimits: function(e) {
            if (! (0 > e)) {
                var r = this.that,
                n = r.iRenderHead,
                i = r.colModel,
                o = i[e],
                a = n.getLeft(e) + o._minWidth,
                l = a + o._maxWidth - o._minWidth,
                s = t(n._resizeDiv(e));
                s.draggable("instance") && s.draggable("option", "containment", [a, 0, l, 0])
            }
        },
        resizeStop: function(e, r, n) {
            var i = this.that,
            o = i.colModel,
            a = i.options,
            l = this,
            s = a.numberCell;
            l.$clleft.remove(),
            l.$cl.remove();
            var d, c = e.clientX,
            u = c - n,
            h = t(r.helper),
            f = 1 * h.attr("pq-col-indx");
            if ( - 1 == f) {
                d = null;
                var p = parseInt(s.width),
                g = p + u;
                s.width = g
            } else {
                d = o[f];
                var p = parseInt(d.width),
                g = p + u;
                d.width = g,
                d._resized = !0
            }
            i._trigger("columnResize", e, {
                colIndx: f,
                column: d,
                dataIndx: d ? d.dataIndx: null,
                oldWidth: p,
                newWidth: d ? d.width: s.width
            }),
            i.refresh({
                soft: !0
            })
        }
    },
    e.cDragColumns = function(e) {
        var r = this;
        r.that = e,
        r.$drag_helper = null;
        var n = e.options.dragColumns,
        i = n.topIcon,
        o = n.bottomIcon;
        r.status = "stop",
        r.$arrowTop = t("<div class='pq-arrow-down ui-icon " + i + "'></div>").appendTo(e.element),
        r.$arrowBottom = t("<div class='pq-arrow-up ui-icon " + o + "' ></div>").appendTo(e.element),
        r.hideArrows(),
        n && n.enabled && e.$header.on("mousedown", ".pq-grid-col", r.onColMouseDown(r, e))
    },
    e.cDragColumns.prototype = {
        onColMouseDown: function(e, r) {
            return function(n) {
                var i, o, a, l, s = t(this);
                if (!n.pq_composed) {
                    if (t(n.target).is("input,select,textarea")) return;
                    if (i = r.getHeadCell(s), o = i.col, a = o ? o.parent: null, !o || o.nodrag || o._nodrag || a && 1 == a.colSpan) return;
                    e.setDraggable(n, o, i) && (n.pq_composed = !0, l = t.Event("mousedown", n), t(n.target).trigger(l))
                }
            }
        },
        showFeedback: function(t, e) {
            var r = this.that,
            n = t[0],
            i = n.offsetParent.offsetParent,
            o = r.$grid_center[0].offsetTop,
            a = n.offsetLeft - i.offsetParent.scrollLeft + (e ? 0 : n.offsetWidth) - 8,
            l = o + n.offsetTop - 16,
            s = o + r.$header[0].offsetHeight;
            this.$arrowTop.css({
                left: a,
                top: l,
                display: ""
            }),
            this.$arrowBottom.css({
                left: a,
                top: s,
                display: ""
            })
        },
        showArrows: function() {
            this.$arrowTop.show(),
            this.$arrowBottom.show()
        },
        hideArrows: function() {
            this.$arrowTop.hide(),
            this.$arrowBottom.hide()
        },
        updateDragHelper: function(t) {
            var e = this.that,
            r = e.options.dragColumns,
            n = r.acceptIcon,
            i = r.rejectIcon,
            o = this.$drag_helper;
            o && (t ? (o.children("span.pq-drag-icon").addClass(n).removeClass(i), o.removeClass("ui-state-error")) : (o.children("span.pq-drag-icon").removeClass(n).addClass(i), o.addClass("ui-state-error")))
        },
        onStart: function(t, e, r, n) {
            return function(i) {
                return e._trigger("columnDrag", i.originalEvent, {
                    column: r
                }) === !1 ? !1 : void t.setDroppables(n)
            }
        },
        onDrag: function(e, r) {
            return function(n, i) {
                e.status = "drag";
                var o = t(".pq-drop-hover", r.$header);
                if (o.length > 0) {
                    e.showArrows(),
                    e.updateDragHelper(!0);
                    var a = o.width(),
                    l = n.clientX - o.offset().left + t(document).scrollLeft();
                    a / 2 > l ? (e.leftDrop = !0, e.showFeedback(o, !0)) : (e.leftDrop = !1, e.showFeedback(o, !1))
                } else {
                    e.hideArrows();
                    var s = t(".pq-drop-hover", r.$top);
                    s.length ? e.updateDragHelper(!0) : e.updateDragHelper()
                }
            }
        },
        dragHelper: function(e, r, n) {
            var i = r.options.dragColumns.rejectIcon;
            return function() {
                e.status = "helper",
                r.$header.find(".pq-grid-col-resize-handle").hide();
                var o = t("<div class='pq-col-drag-helper ui-widget-content ui-corner-all panel panel-default' ><span class='pq-drag-icon ui-icon " + i + " glyphicon glyphicon-remove'></span>" + n.pqtitle + "</div>");
                return e.$drag_helper = o,
                o[0]
            }
        },
        _columnIndexOf: function(t, e) {
            for (var r = 0,
            n = t.length; n > r; r++) if (t[r] == e) return r;
            return - 1
        },
        setDraggable: function(e, r, n) {
            var i = t(e.currentTarget),
            o = this,
            a = o.that;
            return i.hasClass("ui-draggable") ? void 0 : (i.draggable({
                distance: 10,
                cursorAt: {
                    top: -18,
                    left: -10
                },
                zIndex: "1000",
                appendTo: a.element,
                revert: "invalid",
                helper: o.dragHelper(o, a, r),
                start: o.onStart(o, a, r, n),
                drag: o.onDrag(o, a),
                stop: function() {
                    a.element && (o.status = "stop", a.$header.find(".pq-grid-col-resize-handle").show(), o.hideArrows())
                }
            }), !0)
        },
        setDroppables: function(e) {
            var r, n, i, o, a, l, s, d = this,
            c = d.that,
            u = e.col,
            h = e.ri,
            f = e.o_ci,
            p = f + u.o_colspan,
            g = d.onDrop(),
            v = {
                hoverClass: "pq-drop-hover ui-state-highlight",
                accept: ".pq-grid-col",
                tolerance: "pointer",
                drop: g
            },
            m = c.$header.find(":not(.pq-grid-header-search-row)>.pq-grid-col");
            for (s = m.length; s--;) a = t(m[s]),
            l = a.hasClass("ui-droppable"),
            r = c.getHeadCell(a),
            o = r.col,
            n = r.ri,
            i = r.ci,
            o == u || o.nodrop || o._nodrop || n > h && i >= f && p > i ? l && a.droppable("destroy") : l || a.droppable(v)
        },
        onDrop: function() {
            var e = this,
            r = this.that;
            return function(n, i) {
                if (!e.dropPending) {
                    var o = 1 * i.draggable.attr("pq-col-indx"),
                    a = 1 * i.draggable.attr("pq-row-indx"),
                    l = t(this),
                    s = 1 * l.attr("pq-col-indx"),
                    d = 1 * l.attr("pq-row-indx"),
                    c = e.leftDrop,
                    u = e.moveColumn(o, s, c, a, d);
                    e.dropPending = !0,
                    window.setTimeout(function() {
                        r.iColModel.init();
                        var t = r._trigger("columnOrder", null, {
                            dataIndx: u.dataIndx,
                            column: u,
                            oldcolIndx: o,
                            colIndx: r.getColIndx({
                                column: u
                            })
                        });
                        t !== !1 && r.refresh(),
                        e.dropPending = !1
                    },
                    0)
                }
            }
        },
        getRowIndx: function(t, e, r) {
            for (var n, i; r && (n = t[r][e], i = t[r - 1][e], n == i);) r--;
            return r
        },
        moveColumn: function(t, e, r, n, i) {
            var o = this.that,
            a = this,
            l = o.options.colModel,
            s = o.headerCells,
            d = o.depth - 1,
            n = null == n ? a.getRowIndx(s, t, d) : n,
            i = null == i ? a.getRowIndx(s, e, d) : i,
            c = s[n][t],
            u = s[i][e],
            h = n ? s[n - 1][t].colModel: l,
            f = i ? s[i - 1][e].colModel: l,
            p = a._columnIndexOf(h, c),
            g = r ? 1 : 0,
            v = h.splice(p, 1)[0],
            m = a._columnIndexOf(f, u) + 1 - g;
            return f.splice(m, 0, v),
            v
        }
    },
    e.cHeaderSearch = function(t) {},
    e.cHeaderSearch.prototype = {
        getCellEd: function(e) {
            var r = this,
            n = r.data.length - 1,
            i = t(this.getCell(n, e)),
            o = i.find(".pq-grid-hd-search-field");
            return [i, o]
        },
        _onKeyDown: function(e, r, n) {
            var i, o = this,
            a = this.that,
            l = e.keyCode,
            s = t.ui.keyCode;
            if (l !== s.TAB) return ! 0;
            var d, c = o.getCellIndx(n.closest(".pq-grid-col")[0])[1],
            u = a.colModel,
            h = e.shiftKey,
            f = u[c];
            if ("between" == f.filter.condition && (a.scrollColumn({
                colIndx: c
            }), i = o.getCellEd(c)[1], i[0] == n[0] ? h || (d = i[1]) : h && (d = i[0]), d)) return d.focus(),
            e.preventDefault(),
            !1;
            for (;;) {
                if (h ? c--:c++, 0 > c || c >= u.length) break;
                var f = u[c],
                p = f.filter;
                if (!f.hidden && p) {
                    a.scrollColumn({
                        colIndx: c
                    },
                    function() {
                        var r, r = o.getCellEd(c)[1];
                        return "between" == p.condition && (r = t(h ? r[1] : r[0])),
                        r ? (r.focus(), e.preventDefault(), !1) : void 0
                    });
                    break
                }
            }
        },
        onHeaderKeyDown: function(e, r) {
            var n = t(e.originalEvent.target);
            return n.hasClass("pq-grid-hd-search-field") ? this._onKeyDown(e, r, n) : !0
        },
        _bindFocus: function() {
            function e(e) {
                var i = t(e.target),
                o = i.closest(".pq-grid-hd-search-field"),
                a = o.attr("name");
                if (r.scrollColumn({
                    dataIndx: a
                })) {
                    var l = r.getColIndx({
                        dataIndx: a
                    }),
                    s = n.get$Ele(l, a);
                    s.focus()
                }
            }
            for (var r = this.that,
            n = this,
            i = r.$header.find(".pq-grid-header-search-row"), o = 0; o < i.length; o++) t(i[o]).on("focusin", e)
        },
        createListener: function(t) {
            var e = {},
            r = this.that;
            return e[t] = function(t, e) {
                r.filter({
                    rules: [{
                        dataIndx: e.dataIndx,
                        value: e.value,
                        value2: e.value2
                    }]
                })
            },
            e
        },
        onCreateHeader: function() {
            var t = this,
            e = t.that,
            r = e.options,
            n = r.filterModel;
            if (n.header) for (var i = (e.colModel, r.freezeCols, t.colDef), o = 0, a = i.length; a > o; o++) {
                var l = i[o],
                s = l.colIndx,
                d = l.column,
                c = d.filter;
                c && t.postRenderCell(d, s)
            }
        },
        postRenderCell: function(e, r) {
            var n = e.dataIndx,
            i = e.filter,
            o = this,
            a = o.that,
            l = {
                button: "click",
                select: "change",
                checkbox: "change",
                textbox: "timeout"
            },
            s = this.getCellEd(r),
            d = s[0],
            c = s[1];
            if (0 != c.length) {
                var u = i.type,
                h = i.value;
                "checkbox" == u && "triple" == i.subtype ? c.pqval({
                    val: h
                }) : "select" == u && (c = t(c.filter("select")), null != h && c.val(h));
                var f = i.init,
                p = i.listener,
                g = i.listeners || [p ? p: l[u]];
                f && a.callFn(f, {
                    dataIndx: n,
                    column: e,
                    $cell: d,
                    $editor: c
                });
                for (var v = 0; v < g.length; v++) {
                    var m = g[v],
                    w = typeof m,
                    x = {};
                    "string" == w ? m = o.createListener(m) : "function" == w && (x[l[u]] = m, m = x);
                    for (var y in m) o.bindListener(c, y, m[y], e)
                }
            }
        },
        fakeEvent: function(t, e) {
            if ("timeout" == e) {
                var r, n = this.that.options.filterModel.timeout;
                t.bind("keyup change",
                function() {
                    clearTimeout(r),
                    r = setTimeout(function() {
                        t.triggerHandler("timeout")
                    },
                    n)
                })
            }
        },
        bindListener: function(e, r, n, i) {
            var o = this.that,
            a = i.filter.value,
            l = i.filter.value2;
            this.fakeEvent(e, r),
            e.on(r,
            function(r) {
                var s, d, c = i.filter;
                return "checkbox" == c.type ? s = "triple" == c.subtype ? e.pqval({
                    incr: !0
                }) : !!e.is(":checked") : "between" == c.condition ? (s = t(e[0]).val(), d = t(e[1]).val()) : s = e.val(),
                s = "" === s ? void 0 : s,
                d = "" === d ? void 0 : d,
                a !== s || l !== d ? (a = s, l = d, n = pq.getFn(n), n.call(o, r, {
                    column: i,
                    dataIndx: i.dataIndx,
                    value: s,
                    value2: d
                })) : void 0
            })
        },
        betweenTmpl: function(t, e) {
            var r = ["<div class='pq-from-div'>", t, "</div>", "<span class='pq-from-to-center'>-</span>", "<div class='pq-to-div'>", e, "</div>"].join("");
            return r
        },
        renderFilterCell: function(t, r, n) {
            var i, o = this,
            a = o.that,
            l = t.filter,
            s = a.options.filterModel,
            d = t.cls,
            c = " ui-corner-all",
            u = t.halign || t.align;
            if (u && n.push("pq-align-" + u), d && n.push(d), l) {
                var h, f = t.dataIndx,
                p = l.type,
                g = l.value,
                v = l.condition,
                m = "pq-grid-hd-search-field " + (l.cls || ""),
                w = l.style || "",
                x = l.attr || "",
                y = "";
                if ("between" == v && (h = l.value2, h = null != h ? h: ""), "textbox" === p) g = g ? g: "",
                m = m + " pq-search-txt" + c,
                y = "between" == v ? this.betweenTmpl(this._input(f, g, m + " pq-from", w, x, s), this._input(f, h, m + " pq-to", w, x, s)) : this._input(f, g, m, w, x, s);
                else if ("textarea" === p) g = g ? g: "",
                m = m + " pq-search-txt" + c,
                y = "between" == v ? this.betweenTmpl(this._textarea(f, g, m + " pq-from", w, x), this._textarea(f, h, m + " pq-to", w, x)) : this._textarea(f, g, m, w, x);
                else if ("select" === p) if (l.cache) y = l.cache;
                else {
                    var C = l.options,
                    _ = typeof C;
                    "string" != _ && "function" != _ || (C = a.callFn(C, {
                        column: t,
                        value: g,
                        dataIndx: f,
                        cls: m,
                        style: w,
                        attr: x
                    })),
                    m += c;
                    var I = ["name='", f, "' class='", m, "' style='", w, "' ", x].join("");
                    y = e.select({
                        options: C,
                        attr: I,
                        prepend: l.prepend,
                        valueIndx: l.valueIndx,
                        labelIndx: l.labelIndx,
                        groupIndx: l.groupIndx
                    }),
                    l.cache = y
                } else if ("checkbox" == p) {
                    var b = null == g || 0 == g ? "": "checked=checked";
                    y = ["<input ", b, " name='", f, "' type=checkbox class='" + m + "' style='" + w + "' " + x + "/>"].join("")
                } else "string" == typeof p ? y = p: "function" == typeof p && (y = p.call(a, {
                    width: t.outerWidth,
                    value: g,
                    value2: h,
                    column: t,
                    dataIndx: f,
                    cls: m,
                    attr: x,
                    style: w
                }));
                y && n.push("pq-col-" + r),
                i = ["<div class='pq-td-div' >", "", y, "</div>"].join("")
            } else i = ["<div class='pq-td-div' >", "&nbsp;", "</div>"].join("");
            return i
        },
        _input: function(t, e, r, n, i, o) {
            return ["<input ", , , ' value="', e, "\" name='", t, "' type=text style='", n, "' class='", r, "' ", i, " />"].join("")
        },
        _textarea: function(t, e, r, n, i) {
            return ["<textarea name='", t, "' style='" + n + "' class='" + r + "' " + i + " >", e, "</textarea>"].join("")
        }
    }
} (jQuery),
function(t) {
    t(function() {
        var r = e.Z,
        n = e.cssZ,
        i = r(),
        o = n();
        e.isZoom = function() {
            var t = r(),
            e = n();
            return i != t || o != e ? (i = t, o = e, !0) : void 0
        };
        var a = e.isSB,
        l = a();
        t.paramquery.onResize(document.body,
        function() {
            var e = a();
            e != l && (l = e, t(window).trigger("resize", {
                SB: !0
            }))
        })
    }),
    t(window).on("resize",
    function() {
        e.ISZOOM = e.isZoom()
    });
    var e = t.paramquery.cRefresh = function(e) {
        var r = this;
        r.vrows = [],
        r.that = e,
        e.on("dataReadyDone",
        function() {
            r.addRowIndx()
        }),
        t(window).on("resize" + e.eventNamespace + " orientationchange" + e.eventNamespace, r.onWindowResize.bind(r))
    };
    t.extend(e, {
        Z: function() {
            return (window.outerWidth - 8) / window.innerWidth
        },
        cssZ: function() {
            return document.body.style.zoom
        },
        isFullScreen: function() {
            return document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen || window.innerHeight == screen.height
        },
        isSB: function() {
            return t(document).height() > t(window).height()
        }
    }),
    e.prototype = {
        addRowIndx: function() {
            for (var t, e = this.that,
            r = e.get_p_data(), n = r.length; n--;) t = r[n],
            t && (t.pq_ri = n)
        },
        setGridAndCenterHeightForFlex: function() {
            var t = this.that;
            t.element.height(""),
            t.$grid_center.height(""),
            t.dims.htGrid = t.element.height()
        },
        setGridWidthForFlex: function() {
            var t = this.that,
            e = t.options,
            r = this.maxWidthPixel,
            n = t.element,
            i = t.iRenderB.getFlexWidth();
            e.maxWidth && i >= this.maxWidthPixel && (i = r),
            t._trigger("contWd"),
            n.width(i + "px"),
            t.dims.wdGrid = i
        },
        _calcOffset: function(t) {
            var e = /(-|\+)([0-9]+)/,
            r = e.exec(t);
            return r && 3 === r.length ? parseInt(r[1] + r[2]) : 0
        },
        setMax: function(t) {
            var e = this.that,
            r = e.element,
            n = e.options,
            i = n[t];
            i ? (i == parseInt(i) && (i += "px"), r.css(t, i)) : r.css(t, "")
        },
        refreshGridWidthAndHeight: function() {
            var e, r, n = this.that,
            i = n.options,
            o = n.dims,
            a = (i.width + "").indexOf("%") > -1,
            l = (i.height + "").indexOf("%") > -1,
            s = (i.maxHeight + "").indexOf("%") > -1,
            d = "flex" == i.height,
            c = s && d,
            u = (i.maxWidth + "").indexOf("%") > -1,
            h = "flex" == i.width,
            f = u && h,
            p = n.element;
            if (a || l || c || f) {
                var g = p.parent();
                if (!g.length) return;
                var v, m;
                g[0] == document.body || "fixed" == p.css("position") ? (v = t(window).width(), m = window.innerHeight || t(window).height()) : (v = g.width(), m = g.height());
                var w = this._calcOffset,
                x = a ? w(i.width) : 0,
                y = l ? w(i.height) : 0;
                f ? e = parseInt(i.maxWidth) * v / 100 : a && (e = parseInt(i.width) * v / 100 + x),
                c ? r = parseInt(i.maxHeight) * m / 100 : l && (r = parseInt(i.height) * m / 100 + y)
            }
            e || (h && i.maxWidth ? u || (e = i.maxWidth) : a || (e = i.width)),
            i.maxWidth && (this.maxWidthPixel = e),
            r || (d && i.maxHeight ? s || (r = i.maxHeight) : l || (r = i.height)),
            parseFloat(e) == e ? (e = e < i.minWidth ? i.minWidth: e, p.css("width", e)) : "auto" === e && p.width(e),
            parseFloat(r) == r && (r = r < i.minHeight ? i.minHeight: r, p.css("height", r)),
            o.wdGrid = Math.round(p.width()),
            o.htGrid = Math.round(p.height())
        },
        isReactiveDims: function() {
            var t = this.that,
            e = t.options,
            r = e.width,
            n = e.height,
            i = e.maxWidth,
            o = e.maxHeight,
            a = function(t) {
                return - 1 != (t + "").indexOf("%")
            },
            l = a(r),
            s = "auto" === r,
            d = a(n),
            c = a(i),
            u = a(o);
            return l || s || d || c || u
        },
        getParentDims: function() {
            var e, r, n = this.that,
            i = n.element,
            o = i.parent();
            return o.length ? (o[0] == document.body || "fixed" == i.css("position") ? (r = window.innerHeight || t(window).height(), e = t(window).width()) : (r = o.height(), e = o.width()), [e, r]) : []
        },
        onWindowResize: function(r, n) {
            var i, a, l, s, d, c = this,
            u = c.that,
            h = u.dims,
            f = h.htParent,
            p = h.wdParent,
            g = u.element;
            if (!e.isFullScreen() && !(t.support.touch && o.editModel.indices && t(document.activeElement).is(".pq-editor-focus") || n && (d = n.$grid, d && (d == g || 0 == g.closest(d).length)))) return s = c.isReactiveDims(),
            e.ISZOOM ? c.setResizeTimer(function() {
                c.refresh({
                    soft: !0
                })
            }) : void(s && c.setResizeTimer(function() {
                if (l = c.getParentDims(), a = l[0], i = l[1], i == f && a == p) {
                    if (parseInt(g.width()) == parseInt(h.wdGrid)) return
                } else h.htParent = i,
                h.wdParent = a;
                c.refresh({
                    soft: !0
                })
            }))
        },
        setResizeTimer: function(t) {
            var e = this,
            r = e.that;
            clearTimeout(e._autoResizeTimeout),
            e._autoResizeTimeout = window.setTimeout(function() {
                r.element && (t ? t() : e.refreshAfterResize())
            },
            r.options.autoSizeInterval || 100)
        },
        refresh: function(t) {
            t = t || {};
            var e, r = this,
            n = r.that,
            i = null == t.header ? !0 : t.header,
            o = t.pager,
            a = !t.soft,
            l = n.element,
            s = n.dims = n.dims || {
                htCenter: 0,
                htHead: 0,
                htSum: 0,
                htBody: 0,
                wdCenter: 0,
                htTblSum: 0
            };
            if (t.colModel && n.refreshCM(), !l[0].offsetWidth) return void l.addClass("pq-pending-refresh");
            t.toolbar && n.refreshToolbar(),
            e = n.options,
            e.collapsible._collapsed = !1,
            r.setMax("maxHeight"),
            r.setMax("maxWidth"),
            r.refreshGridWidthAndHeight(),
            a && o !== !1 && n._refreshPager(),
            s.htCenter = r.setCenterHeight(),
            s.wdCenter = s.wdGrid,
            n.iRenderB.init({
                header: i,
                soft: t.soft,
                source: t.source
            }),
            "flex" == e.height && r.setGridAndCenterHeightForFlex(),
            "flex" == e.width && r.setGridWidthForFlex();
            var d = this.getParentDims();
            s.wdParent = d[0],
            s.htParent = d[1],
            a && n._createCollapse(),
            e.dataModel.postDataOnce = void 0
        },
        setCenterHeight: function() {
            var t, e = this.that,
            r = e.$top,
            n = e.options;
            return ("flex" !== n.height || n.maxHeight) && (t = e.dims.htGrid - (n.showTop ? r[0].offsetHeight + parseInt(r.css("marginTop")) : 0) - e.$bottom[0].offsetHeight + 1, t = t >= 0 ? t: "", e.$grid_center.height(t)),
            t
        }
    },
    t(function() {})
} (jQuery),
function(t) {
    var e = !0;
    t(function() {
        var r = t("<input type='checkbox' style='position:fixed;left:-50px;top:-50px;'/>").appendTo(document.body);
        r[0].indeterminate = !0,
        r.on("change",
        function() {
            e = !1
        }),
        r.click(),
        r.remove()
    });
    var r = t.paramquery.cCheckBoxColumn = function(e, r) {
        var n = this;
        this.that = e,
        this.options = e.options,
        this.column = r;
        var i = {
            all: !1,
            header: !1,
            select: !1,
            check: !0,
            uncheck: !1
        },
        o = r.cb = t.extend({},
        i, r.cb),
        a = this.dataIndx = r.dataIndx;
        r._render = n.cellRender(r),
        e.on("dataAvailable",
        function() {
            e.one("dataReady",
            function() {
                return n.onDataReady()
            })
        }).on("dataReady",
        function() {
            n.setValCBox()
        }).on("valChange", n.onCheckBoxChange(n, e)).on("cellKeyDown",
        function(t, e) {
            return n.onCellKeyDown(t, e)
        }).on("refreshHeader",
        function(t, e) {
            return n.refreshHeader(t, e)
        }),
        r.cb.select && e.on("rowSelect", n.onRowSelect(n, e)).on("beforeRowSelectDone", n.onBeforeRowSelect(n, e, a, o.check, o.uncheck)).on("change", n.onChange(n, e, a, o.check, o.uncheck))
    };
    r.prototype = {
        cellRender: function(t) {
            return function(e) {
                var r, n = e.rowData;
                if (!n.pq_gtitle && !n.pq_gsummary) return r = t.cb.check === e.cellData ? "checked": "",
                "<input type='checkbox' " + r + " />"
            }
        },
        hasHeaderChkBox: function() {
            return this.column.cb.header
        },
        isEditableCell: function(t, e, r, n, i) {
            var o = this.that;
            return ! o.isEditableRow({
                rowIndx: t,
                rowData: e
            }) || r && !o.isEditableCell({
                rowIndx: t,
                rowData: e,
                column: r,
                colIndx: n,
                dataIndx: i
            }) ? void 0 : !0
        },
        onBeforeRowSelect: function(t, e, r, n, i) {
            return function(o, a) {
                if ("checkbox" != a.source) {
                    var l = function(o) {
                        for (var a, l, s, d = o.length,
                        c = e.columns[r], u = e.colIndxs[r]; d--;) s = o[d],
                        a = s.rowIndx,
                        l = s.rowData,
                        t.isEditableCell(a, l, c, u, r) ? l[r] = l.pq_rowselect ? i: n: o.splice(d, 1)
                    };
                    l(a.addList),
                    l(a.deleteList)
                }
            }
        },
        onCellKeyDown: function(e, r) {
            if (r.dataIndx == this.dataIndx && (13 == e.keyCode || 32 == e.keyCode)) {
                var n = t(e.originalEvent.target).find("input");
                return n.click(),
                !1
            }
        },
        onChange: function(t, e, r, n, i) {
            return function(t, i) {
                if ("checkbox" != i.source) {
                    var o = [],
                    a = [],
                    l = function(t) {
                        t.forEach(function(t) {
                            var e, i = t.newRow,
                            l = t.oldRow;
                            i.hasOwnProperty(r) && (e = i[r], e === n ? o.push(t) : l && l[r] === n && a.push(t))
                        })
                    };
                    l(i.addList),
                    l(i.updateList),
                    e.SelectRow().update({
                        addList: o,
                        deleteList: a
                    })
                }
            }
        },
        onCheckBoxChange: function(t, e) {
            return function(r, n) {
                if (n.dataIndx == t.dataIndx) {
                    var i = t.column.cb,
                    o = r.originalEvent,
                    a = n.rowData,
                    l = n.rowIndx,
                    s = n.dataIndx,
                    d = n.input.checked,
                    c = {},
                    u = {};
                    c[s] = d ? i.check: i.uncheck,
                    u[s] = a[s];
                    var h = [{
                        rowData: a,
                        rowIndx: l,
                        oldRow: u,
                        newRow: c
                    }];
                    if (n.check = d, n.rows = h, e._trigger("beforeCheck", o, n) === !1) return e.refreshCell({
                        rowIndx: l,
                        dataIndx: s
                    }),
                    !1;
                    var f = {
                        source: "checkbox",
                        updateList: h
                    };
                    if (f.history = f.track = i.select ? !1 : null, e._digestData(f) === !1) return e.refreshCell({
                        rowIndx: l,
                        dataIndx: s
                    }),
                    !1;
                    e.refreshRow({
                        rowIndx: l
                    }),
                    h = n.rows = f.updateList,
                    e._trigger("check", o, n),
                    i.select && e.iRows[d ? "add": "remove"]({
                        rows: h,
                        source: "checkbox"
                    }),
                    t.setValCBox()
                }
            }
        },
        onDataReady: function() {
            var t, e = this.that,
            r = e.get_p_data(),
            n = 0,
            i = r.length,
            o = this.column,
            a = o.cb,
            l = o.dataIndx;
            if (null != l && r && a.select) for (; i > n; n++)(t = r[n]) && (t[l] === a.check ? t.pq_rowselect = !0 : t.pq_rowselect && (t[l] = a.check))
        },
        onHeaderChange: function(e) {
            for (var r = t(e.target), n = this.that, i = this.column, o = i.dataIndx, a = n.options, l = i.cb, s = l.all, d = s ? a.dataModel.data: n.pdata, c = "remote" == a.pageModel.type, u = c || !s ? n.riOffset: 0, h = [], f = {
                column: i,
                dataIndx: o,
                source: "header"
            },
            p = r[0].checked, g = 0, v = d.length; v > g; g++) {
                var m = g + u,
                w = d[g],
                x = {},
                y = {};
                x[o] = p ? l.check: l.uncheck,
                y[o] = w[o],
                h.push({
                    rowIndx: m,
                    rowData: w,
                    newRow: x,
                    oldRow: y
                })
            }
            var C = {
                updateList: h,
                source: "checkbox"
            };
            return C.history = C.track = l.select ? !1 : null,
            f.check = p,
            f.rows = h,
            n._trigger("beforeCheck", e, f) === !1 ? (n.refreshHeader(), !1) : n._digestData(C) === !1 ? (n.refreshHeader(), !1) : (n.refresh({
                header: !1
            }), h = f.rows = C.updateList, n._trigger("check", e, f), void(l.select && n.iRows[p ? "add": "remove"]({
                rows: h,
                source: "checkbox"
            })))
        },
        onRowSelect: function(t, e) {
            return function(t, r) {
                "checkbox" != r.source && (r.addList.length || r.deleteList.length) && e.refresh()
            }
        },
        refreshHeader: function(t, r) {
            var n = this;
            if (this.hasHeaderChkBox()) {
                var i = this.that,
                o = i.pdata;
                if (o) {
                    var a = i.getCellHeader({
                        dataIndx: this.dataIndx
                    });
                    if (a) {
                        var l = this.$inp = a.find("input");
                        this.setValCBox(),
                        e && l.on("click",
                        function(t) {
                            null == l.data("pq_value") && (l[0].checked = !0, l.data("pq_value", !0), n.onHeaderChange(t))
                        }),
                        l.on("change",
                        function(t) {
                            n.onHeaderChange(t)
                        })
                    }
                }
            }
        },
        setValCBox: function() {
            if (this.hasHeaderChkBox() && this.$inp) {
                var t, e, r = this.that,
                n = this.options,
                i = this.dataIndx,
                o = this.column,
                a = r.colIndxs[i],
                l = o.cb,
                s = l.all,
                d = "remote" == n.pageModel.type,
                c = d || !s ? r.riOffset: 0,
                u = s ? n.dataModel.data: r.pdata,
                h = null,
                f = 0,
                p = 0,
                g = 0;
                if (u) {
                    for (var v = 0,
                    m = u.length; m > v; v++) t = u[v],
                    e = v + c,
                    this.isEditableCell(e, t, o, a, i) && (p++, t[i] === l.check ? f++:g++);
                    f == p && p ? h = !0 : g == p && (h = !1),
                    this.$inp.pqval({
                        val: h
                    })
                }
            }
        }
    }
} (jQuery),
function(t) {
    function e(t, e, r) {
        for (var n = 0,
        i = t.length; i > n; n++) {
            for (var o, a = t[n], l = {},
            s = 0, d = e.length; d > s; s++) o = e[s],
            l[o] = a[o];
            r.push(l)
        }
    }
    var r = t.paramquery,
    n = {};
    n.options = {
        flex: {
            on: !0,
            one: !1,
            all: !0
        },
        detailModel: {
            cache: !0,
            offset: 100,
            expandIcon: "ui-icon-triangle-1-se glyphicon glyphicon-minus",
            collapseIcon: "ui-icon-triangle-1-e glyphicon glyphicon-plus",
            height: 180
        },
        dragColumns: {
            enabled: !0,
            acceptIcon: "ui-icon-check glyphicon-ok",
            rejectIcon: "ui-icon-closethick glyphicon-remove",
            topIcon: "ui-icon-circle-arrow-s glyphicon glyphicon-circle-arrow-down",
            bottomIcon: "ui-icon-circle-arrow-n glyphicon glyphicon-circle-arrow-up"
        },
        track: null,
        mergeModel: {
            flex: !1
        },
        realFocus: !0,
        sortModel: {
            on: !0,
            type: "local",
            multiKey: "shiftKey",
            number: !0,
            single: !0,
            cancel: !0,
            sorter: [],
            useCache: !0,
            ignoreCase: !1
        },
        filterModel: {
            on: !0,
            type: "local",
            mode: "AND",
            header: !1,
            timeout: 400
        }
    },
    n._create = function() {
        var t = this,
        e = t.options;
        t.listeners = {},
        t._queueATriggers = {},
        t.iHistory = new r.cHistory(t),
        t.iGroup = new r.cGroup(t),
        t.iMerge = new r.cMerge(t),
        t.iFilterData = new r.cFilterData(t),
        t.iSelection = new o.Selection(t),
        t.iHeaderSearch = new r.cHeaderSearch(t),
        t.iUCData = new r.cUCData(t),
        t.iMouseSelection = new r.cMouseSelection(t),
        t._super(),
        new r.cFormula(t),
        t.iDragColumns = new r.cDragColumns(t),
        t.refreshToolbar(),
        "remote" === e.dataModel.location && t.refresh(),
        t.on("dataAvailable",
        function() {
            t.one("refreshDone",
            function() {
                t._trigger("ready"),
                setTimeout(function() {
                    t.element && t._trigger("complete")
                },
                0)
            })
        }),
        t.__init(),
        t.refreshDataAndView({
            header: !0
        })
    };
    var i;
    //DTS 此处修改
    n.__init = function() {
        i || (i = t(["<div style='position:fixed;bottom:0;right:25px;padding:0 2px;margin:0;opacity:0.5;z-index:10000;border:1px solid lightgray;border-radius:5px;pointer-events:none;'>", "<a style='font-size:10px;display:none' href='http://paramquery.com/pro'>ParamQuery Pro Eval</a>", "</div>"].join("")).appendTo(document.body))
    },
    t.widget("paramquery.pqGrid", r._pqGrid, n),
    t.widget.extend = function() {
        var e, r, n = Array.prototype.shift,
        i = t.isPlainObject,
        o = t.isArray,
        a = t.widget.extend,
        l = n.apply(arguments);
        "boolean" == typeof l && (e = l, l = n.apply(arguments));
        var s, d, c, u = arguments,
        h = 0,
        f = u.length;
        for (null == e && (e = f > 1); f > h; h++) {
            s = u[h];
            for (d in s) c = s[d],
            void 0 !== c && (r = !(h > 0), i(c) ? (l[d] = l[d] || {},
            a(r, l[d], c)) : o(c) ? l[d] = e && r ? c.slice() : c: l[d] = c)
        }
        return l
    };
    var o = window.pq = window.pq || {};
    o.grid = function(e, r) {
        var n = t(e).pqGrid(r),
        i = n.data("paramqueryPqGrid") || n.data("paramquery-pqGrid");
        return i
    },
    o.grid.render = {},
    r.pqGrid.regional = {};
    var a = r.pqGrid.prototype;
    r.pqGrid.defaults = a.options,
    a.focus = function(e) {
        var r, n, i, o, a, l, s, d, c = e || {},
        u = this,
        h = u.options,
        f = c.$td,
        p = document.activeElement,
        g = u.$cont,
        v = g[0],
        m = c.rowIndxPage,
        w = c.colIndx;
        if (f) null != m && null != w || (i = this.getCellIndices({
            $td: f
        }), m = i.rowIndxPage, w = i.colIndx);
        else {
            if (null == m || null == w) {
                if (n = this._focusEle, p && p != document.body && "pq-grid-excel" != p.id && "pq-body-outer" != p.className) return void(o = !0);
                n ? (m = n.rowIndxPage, w = n.colIndx) : o = !0
            }
            null != m && (s = u.iMerge, l = m + u.riOffset, s.ismergedCell(l, w) && (d = s.getRootCellO(l, w), m = d.rowIndxPage, w = d.colIndx), f = u.getCell({
                rowIndxPage: m,
                colIndx: w
            }))
        }
        if (null != m && null != w) {
            var x = f[0] && this.iRenderB.inViewport(m, w, f[0]);
            x ? (p != document.body && t(p).blur(), g.find(".pq-focus").removeAttr("tabindex").removeClass("pq-focus"), g.removeAttr("tabindex"), n = this._focusEle = this._focusEle || {},
            f && (r = f[0]) && f.hasClass("pq-grid-cell") && !r.edited ? (n.$ele && n.$ele.length && n.$ele[0].removeAttribute("tabindex"), n.$ele = f, n.rowIndxPage = m, n.colIndx = w, r.setAttribute("tabindex", "-1"), o || (f.addClass("pq-focus"), r.focus())) : (a = h.dataModel.data, a && a.length || v.setAttribute("tabindex", 0))) : (n = this._focusEle, n && g.find(".pq-focus").removeClass("pq-focus"), f && (f.addClass("pq-focus"), this._focusEle = {
                $ele: f,
                rowIndxPage: m,
                colIndx: w
            }), document.activeElement != v && (g.attr("tabindex", 0), v.focus()))
        }
    },
    a.onfocus = function(t) {
        var e = this._focusEle;
        e && this.getCell(e).addClass("pq-focus")
    },
    a.onblur = function() {
        var t = this._focusEle;
        if (t) {
            var e = (t.rowIndxPage, t.colIndx, document.activeElement);
            this.$cont.find(".pq-focus").removeClass("pq-focus"),
            e && e != document.body && "pq-grid-excel" != e.id && "pq-body-outer" != e.className && (this._focusEle = {})
        }
    },
    a.callFn = function(t, e) {
        return o.getFn(t).call(this, e)
    },
    a.rowExpand = function(t) {
        this.iHierarchy.rowExpand(t)
    },
    a.rowInvalidate = function(t) {
        this.iHierarchy.rowInvalidate(t)
    },
    a.rowCollapse = function(t) {
        this.iHierarchy.rowCollapse(t)
    },
    a.saveState = function(e) {
        e = e || {};
        for (var r, n, i, o = this,
        a = o.element,
        l = t.extend,
        s = o.options,
        d = s.sortModel,
        c = l(!0, {},
        {
            sorter: d.sorter
        }), u = s.pageModel, h = {
            rPP: u.rPP,
            curPage: u.curPage
        },
        f = o.colModel, p = [], g = 0, v = f.length, m = s.groupModel, w = l(!0, {},
        {
            dataIndx: m.dataIndx,
            dir: m.dir,
            collapsed: m.collapsed,
            merge: m.merge,
            grandSummary: m.grandSummary
        }), x = a[0].id; v > g; g++) r = f[g],
        i = {
            width: r.width,
            dataIndx: r.dataIndx,
            hidden: r.hidden
        },
        (n = r.filter) && (i.filter = {
            value: n.value,
            value2: n.value2,
            on: n.on
        }),
        p[g] = i;
        var y = {
            colModel: p,
            height: s.height,
            datestamp: Date.now(),
            width: s.width,
            groupModel: w,
            pageModel: h,
            sortModel: c,
            freezeRows: s.freezeRows,
            freezeCols: s.freezeCols
        };
        return e.stringify !== !1 && (y = JSON.stringify(y), e.save !== !1 && "undefined" != typeof Storage && localStorage.setItem("pq-grid" + (x || ""), y)),
        y
    },
    a.loadState = function(e) {
        e = e || {};
        var r, n = this,
        i = n.element,
        o = t.widget.extend,
        a = t.extend,
        l = i[0].id,
        s = e.state || ("undefined" == typeof Storage ? void 0 : localStorage.getItem("pq-grid" + (l || "")));
        if (!s) return ! 1;
        "string" == typeof s && (s = JSON.parse(s));
        for (var d, c, u, h = s.colModel,
        f = [], p = [], g = [], v = [], m = [], w = n.options, x = n.depth > 1, y = x ? n.colModel: w.colModel, C = 0, _ = h.length; _ > C; C++) d = h[C],
        u = d.dataIndx,
        p[u] = !0,
        g[u] = C,
        f[u] = d.width,
        v[u] = d.filter,
        m[u] = d.hidden;
        x || y.sort(function(t, e) {
            return g[t.dataIndx] - g[e.dataIndx]
        });
        for (var C = 0,
        _ = y.length; _ > C; C++) c = y[C],
        u = c.dataIndx,
        p[u] && (c.width = f[u] || c.width, c.filter = a(c.filter, v[u]), c.hidden = m[u]);
        return n.iColModel.init(),
        o(w.sortModel, s.sortModel),
        o(w.pageModel, s.pageModel),
        n.Group().option(s.groupModel, !1),
        r = {
            freezeRows: s.freezeRows,
            freezeCols: s.freezeCols
        },
        isNaN(1 * w.height) || isNaN(1 * s.height) || (r.height = s.height),
        isNaN(1 * w.width) || isNaN(1 * s.width) || (r.width = s.width),
        n.option(r),
        e.refresh !== !1 && n.refreshDataAndView(),
        !0
    },
    a.refreshToolbar = function() {
        var e, r = this,
        n = r.options,
        i = n.toolbar;
        if (r._toolbar && (e = r._toolbar, e.destroy()), i) {
            var a = i.cls,
            a = a ? a: "",
            l = i.style,
            l = l ? l: "",
            s = i.attr,
            s = s ? s: "",
            d = i.items,
            c = t("<div class='" + a + "' style='" + l + "' " + s + " ></div>");
            e ? e.widget().replaceWith(c) : r.$top.append(c),
            e = o.toolbar(c, {
                items: d,
                gridInstance: r,
                bootstrap: n.bootstrap
            }),
            n.showToolbar || c.css("display", "none"),
            r._toolbar = e
        }
    },
    a.isLeftOrRight = function(t) {
        var e = (this.options, this.freezeCols);
        return t > e ? "right": "left"
    },
    a.ovCreateHeader = function(t) {
        this.options.filterModel.header && this.iHeaderSearch.createDOM(t)
    },
    a.filter = function(t) {
        return this.iFilterData.filter(t)
    },
    a._initTypeColumns = function() {
        for (var t = this.colModel,
        e = 0,
        n = t.length; n > e; e++) {
            var i = t[e],
            o = i.type;
            "checkBoxSelection" === o || "checkbox" == o ? (i.type = "checkbox", new r.cCheckBoxColumn(this, i)) : "detail" === o && (i.dataIndx = "pq_detail", this.iHierarchy = new r.cHierarchy(this, i))
        }
    },
    a.refreshHeader = function() {
        this.iRenderHead.refreshHS()
    },
    a.refreshHeaderFilter = function(t) {
        var e = this.normalize(t),
        r = e.colIndx,
        n = e.column,
        i = this.iRenderHead,
        o = {},
        a = i.rows - 1;
        i.refreshCell(a, r, o, n),
        i.postRenderCell(n, r, a)
    },
    a._refreshHeaderSortIcons = function() {
        this.iHeader.refreshHeaderSortIcons()
    },
    a.pageData = function() {
        return this.pdata
    },
    a.getData = function(t) {
        t = t || {};
        var r = t.dataIndx,
        n = r ? r.length: 0,
        i = t.data,
        o = this.options.dataModel,
        a = o.data || [],
        l = o.dataUF || [],
        s = [];
        if (!n) return l.length ? a.concat(l) : a;
        i ? e(i, r, s) : (e(a, r, s), e(l, r, s));
        for (var d = [], c = 0; n > c; c++) {
            var u = r[c],
            h = this.getColumn({
                dataIndx: u
            });
            d.push({
                dataIndx: u,
                dir: "up",
                dataType: h.dataType,
                sortType: h.sortType
            })
        }
        s = this.iSort._sortLocalData(d, s);
        for (var f = [], p = void 0, g = 0, v = s.length; v > g; g++) {
            var m = s[g],
            w = JSON.stringify(m);
            w !== p && (f.push(m), p = w)
        }
        return f
    },
    a.get_p_data = function() {
        var t, e, r, n, i = this.options,
        o = i.pageModel,
        a = o.type,
        l = i.dataModel.data,
        s = this.pdata,
        d = [];
        return a ? (e = o.rPP, r = this.riOffset, t = "remote" == a, d = t ? new Array(r) : l.slice(0, r), n = t ? [] : l.slice(r + e), d.concat(s, n)) : s || l
    },
    a._onDataAvailable = function(t) {
        t = t || {};
        var e = this.options,
        r = !t.data,
        n = t.source,
        i = t.sort,
        o = [],
        a = e.filterModel,
        l = e.dataModel,
        s = e.sortModel;
        l.location;
        return r !== !1 && t.trigger !== !1 && this._trigger("dataAvailable", t.evt, {
            source: n
        }),
        o = a && a.on && "local" == a.type ? this.iFilterData.filterLocalData(t).data: l.data,
        "local" == s.type && i !== !1 && (r ? this.sort({
            refresh: !1
        }) : o = this.iSort.sortLocalData(o)),
        r === !1 ? o: void this.refreshView(t)
    },
    a.reset = function(e) {
        e = e || {};
        var r, n, i = this,
        o = e.sort,
        a = i.options,
        l = e.refresh !== !1,
        s = t.extend,
        d = e.filter,
        c = e.group; (o || d || c) && (o && (r = o === !0 ? {
            sorter: []
        }: o, s(a.sortModel, r)), d && !l && this.iFilterData.clearFilters(i.colModel), c && (n = c === !0 ? {
            dataIndx: []
        }: c, i.groupOption(n, !1)), l && (d ? (i.filter({
            oper: "replace",
            rules: []
        }), i.refreshHeader()) : o ? i.sort() : i.refreshView()))
    },
    a._trigger = r._trigger,
    a.on = r.on,
    a.one = r.one,
    a.off = r.off,
    a.pager = function() {
        return this.pagerW
    },
    a.toolbar = function() {
        return this._toolbar.element
    },
    a.Columns = function() {
        return this.iColModel
    },
    r.cColModel = function(t) {
        this.that = t,
        this.init()
    },
    r.cColModel.prototype = {
        alignColumns: function(t, e) {
            for (var r = 0; e > r; r++) {
                var n = t[r];
                if (!n.align) {
                    var i = n.dataType; ! i || "integer" != i && "float" != i || (n.align = "right")
                }
            }
        },
        alter: function(t) {
            var e = this.that;
            t.call(e),
            e.refreshCM(),
            e.refresh()
        },
        assignRowSpan: function() {
            for (var t = this.that,
            e = t.colModel.length,
            r = t.headerCells,
            n = t.depth,
            i = 0; e > i; i++) for (var o = 0; n > o; o++) {
                var a = r[o][i];
                if (! (i > 0 && a == r[o][i - 1] || o > 0 && a == r[o - 1][i])) {
                    for (var l = 1,
                    s = o + 1; n > s; s++) {
                        var d = r[s][i];
                        a == d && l++
                    }
                    a.rowSpan = l
                }
            }
            return r
        },
        autoGenColumns: function() {
            var e = this.that,
            r = e.options,
            n = r.columnTemplate || {},
            i = n.dataType,
            a = n.title,
            l = n.width,
            s = r.dataModel.data,
            d = o.validation,
            c = [];
            if (s && s.length) {
                var u = s[0];
                t.each(u,
                function(t, e) {
                    var r = "string";
                    d.isInteger(e) ? r = e + "".indexOf(".") > -1 ? "float": "integer": d.isDate(e) ? r = "date": d.isFloat(e) && (r = "float"),
                    c.push({
                        dataType: i ? i: r,
                        dataIndx: t,
                        title: a ? a: t,
                        width: l ? l: 100
                    })
                })
            }
            r.colModel = c
        },
        cacheIndices: function() {
            for (var t = this.that,
            e = "JSON" == this.getDataType(), r = {},
            n = {},
            i = {},
            o = t.colModel, a = 0, l = o.length; l > a; a++) {
                var s = o[a],
                d = s.dataIndx;
                null == d && (d = "detail" == s.type ? "pq_detail": e ? "dataIndx_" + a: a, "pq_detail" == d && (s.dataType = "object"), s.dataIndx = d),
                r[d] = s,
                n[d] = a;
                var c = s.validations;
                c && (i[d] = i)
            }
            t.columns = r,
            t.colIndxs = n,
            t.validations = i
        },
        collapse: function(t, e) {
            var r = e.on,
            n = t.colModel || [],
            i = n.length,
            o = e.last ? i - 1 : 0;
            i && (this.each(function(t) {
                t.hidden = r
            },
            n), this.each(function(t) {
                t.hidden = !1
            },
            [n[o]]))
        },
        each: function(t, e) {
            var r = this.that; (e || r.options.colModel).forEach(function(e) {
                t.call(r, e),
                e.colModel && this.each(t, e.colModel)
            },
            this)
        },
        extend: function(e, r) {
            for (var n, i, o = t.extend,
            a = e.length; a--;) {
                var l = e[a];
                for (n in r) void 0 === l[n] && (i = r[n], i && "object" == typeof i ? l[n] = o(!0, {},
                i) : l[n] = i)
            }
        },
        find: function(t, e) {
            for (var r, n, i = this.that,
            o = e || i.options.colModel,
            a = 0,
            l = o.length; l > a; a++) {
                if (r = o[a], t.call(i, r)) return r;
                if (r.colModel && (n = this.find(t, r.colModel))) return n
            }
        },
        getHeadersCells: function() {
            for (var t = this.that,
            e = t.options.colModel,
            r = t.colModel.length,
            n = t.depth,
            i = [], o = 0; n > o; o++) {
                i[o] = [];
                for (var a = 0,
                l = 0,
                s = 0; r > s; s++) {
                    var d;
                    if (0 == o) d = e[a];
                    else {
                        var c = i[o - 1][s],
                        u = c.colModel;
                        if (u && 0 != u.length) {
                            for (var h = s - c.leftPos,
                            f = 0,
                            p = 0,
                            g = 0; g < u.length; g++) if (f += u[g].childCount > 0 ? u[g].childCount: 1, f > h) {
                                p = g;
                                break
                            }
                            d = u[p]
                        } else d = c
                    }
                    var v = d.childCount ? d.childCount: 1;
                    s == l ? (d.leftPos = s, i[o][s] = d, l += v, e[a + 1] && a++) : i[o][s] = i[o][s - 1]
                }
            }
            return t.headerCells = i,
            i
        },
        getDataType: function() {
            var t = this.colModel;
            if (t && t[0]) {
                var e = t[0].dataIndx;
                return "string" == typeof e ? "JSON": "ARRAY"
            }
        },
        init: function() {
            var t, e, r, n = this.that,
            i = n.options,
            o = i.columnTemplate,
            a = i.colModel;
            a || (this.autoGenColumns(), a = i.colModel),
            t = this.nestedCols(a),
            n.depth = t.depth,
            e = n.colModel = t.colModel,
            r = e.length,
            o && this.extend(e, o),
            this.getHeadersCells(),
            this.alignColumns(e, r),
            this.assignRowSpan(),
            this.cacheIndices(),
            n._trigger("CMInit")
        },
        nestedCols: function(t, e, r, n) {
            var i = t.length,
            o = [];
            null == e && (e = 1);
            for (var a = e,
            l = 0,
            s = 0,
            d = 0,
            c = 0,
            u = 0; i > u; u++) {
                var h = t[u],
                f = h.colModel,
                p = h.collapsible;
                if (h.parent = n ? n: void 0, r === !0 && (h.hidden = r), f && f.length) {
                    p && this.collapse(h, p);
                    var g = this.nestedCols(f, e + 1, h.hidden, h);
                    o = o.concat(g.colModel),
                    g.colSpan > 0 ? (g.depth > a && (a = g.depth), h.colSpan = g.colSpan, l += g.colSpan) : h.colSpan = 0,
                    c += g.o_colspan,
                    h.o_colspan = g.o_colspan,
                    h.childCount = g.childCount,
                    d += g.childCount
                } else h.hidden ? h.colSpan = 0 : (h.colSpan = 1, l++),
                c++,
                h.o_colspan = 1,
                h.childCount = 0,
                d++,
                o.push(h)
            }
            return {
                depth: a,
                colModel: o,
                colSpan: l,
                width: s,
                childCount: d,
                o_colspan: c
            }
        },
        reduce: function(t, e) {
            var r = this.that,
            n = [];
            return (e || r.options.colModel).forEach(function(e, i) {
                var o, a, l = t.call(r, e, i);
                l && (a = e.colModel, a && a.length ? (o = this.reduce(t, a), o.length && (l.colModel = o, n.push(l))) : n.push(l))
            },
            this),
            n
        }
    }
} (jQuery),
function(t) {
    function e(e, r) {
        this.that = e;
        var n = this,
        i = e.options;
        n.type = "detail",
        n.refreshComplete = !0,
        n.rowHtDetail = i.detailModel.height,
        e.on("cellClick", n.toggle.bind(n)).on("cellKeyDown",
        function(e, r) {
            return e.keyCode == t.ui.keyCode.ENTER ? n.toggle(e, r) : void 0
        }).on("beforeViewEmpty", n.onBeforeViewEmpty.bind(n)).on("autoRowHeight", n.onAutoRowHeight.bind(n)).one("render",
        function() {
            e.iRenderB.removeView = n.removeView(n, e),
            e.iRenderB.renderView = n.renderView(n, e)
        }).one("destroy", n.onDestroy.bind(n)),
        r._render = n.renderCell.bind(n)
    }
    t.extend(t.paramquery.pqGrid.prototype, {
        parent: function() {
            return this._parent
        },
        child: function(t) {
            var e = this.normalize(t),
            r = e.rowData || {},
            n = r.pq_detail || {},
            i = n.child;
            return i
        }
    }),
    t.paramquery.cHierarchy = e,
    e.prototype = {
        detachCells: function(t) {
            t.children().detach(),
            t.remove()
        },
        getCls: function() {
            return "pq-detail-cont-" + this.that.uuid
        },
        getId: function(t) {
            return "pq-detail-" + t + "-" + this.that.uuid
        },
        getRip: function(t) {
            return 1 * t.id.split("-")[2]
        },
        onAutoRowHeight: function() {
            var e = this,
            r = this.that.iRenderB;
            r.$ele.find("." + e.getCls()).each(function(n, i) {
                var o = e.getRip(i),
                a = r.getHeightCell(o);
                t(i).css("top", a)
            })
        },
        onBeforeViewEmpty: function(t, e) {
            var r = e.rowIndxPage,
            n = this.that.iRenderB,
            i = e.region,
            o = r >= 0 ? "#" + this.getId(r) : "." + this.getCls(),
            a = r >= 0 ? n.$ele.find(o) : n["$c" + i].find(o);
            this.detachCells(a)
        },
        onDestroy: function() { (this.that.getData() || []).forEach(function(t) {
                t.child && t.child.remove()
            })
        },
        onResize: function(t, e) {
            var r, n = [];
            e.resize(function() {
                n.push(e[0]),
                clearTimeout(r),
                r = setTimeout(function() {
                    var e = t.that.pdata,
                    r = [];
                    n.forEach(function(n) {
                        if (document.body.contains(n)) {
                            var i = t.getRip(n),
                            o = n.offsetHeight,
                            a = e[i],
                            l = a.pq_detail.height || t.rowHtDetail;
                            l != o && (a.pq_detail.height = o, r.push([i, o - l]))
                        }
                    }),
                    n = [],
                    r.length && t.softRefresh(r)
                },
                150)
            })
        },
        removeView: function(e, r) {
            var n = r.iRenderB.removeView;
            return function(r, i, o) {
                var a, l, s, d, c = n.apply(this, arguments),
                u = e.getCls(),
                h = this.getCellRegion(r, o);
                for (a = r; i >= a; a++) l = this.getRow(a, h),
                l && 1 == l.children.length && (s = t(l), d = s.children("." + u), 1 == d.length && (e.detachCells(d), l.parentNode.removeChild(l)));
                return c
            }
        },
        renderView: function(e, r) {
            var n = r.iRenderB.renderView;
            return function(i, o, a, l) {
                var s = n.apply(this, arguments),
                d = r.iRenderB,
                c = d.initH,
                u = d.finalH;
                if (c == a && u == l || null == c) {
                    var h, f, p = e.getCls(),
                    g = r.options,
                    v = g.freezeRows,
                    m = g.detailModel.init,
                    w = this.data;
                    if (!e.refreshComplete) return;
                    for (e.refreshComplete = !1, h = i; o >= h; h++) if (f = w[h], f && !f.pq_hidden) {
                        var x = f.pq_detail = f.pq_detail || {},
                        y = x.show,
                        C = x.child;
                        if (!y) continue;
                        C || "function" == typeof m && (C = m.call(r, {
                            rowData: f
                        }), x.child = C);
                        var _ = C.parent(),
                        I = d.getHeightCell(h),
                        b = r.dims.wdContLeft + 5,
                        q = "position:absolute;left:0;top:" + I + "px;padding:5px;width:100%;overflow:hidden;padding-left:" + b + "px;";
                        if (_.length) {
                            if (!document.body.contains(_[0])) throw "incorrectly detached detail";
                            _.css({
                                top: I
                            })
                        } else _ = t("<div role='gridcell' id='" + e.getId(h) + "' class='" + p + "' style='" + q + "'></div>").append(C),
                        t(d.getRow(h, v > h ? "tr": "right")).append(_),
                        e.onResize(e, _);
                        for (var R, D, M = _.find(".pq-grid"), T = 0, E = M.length; E > T; T++) R = t(M[T]),
                        D = R.pqGrid("instance"),
                        D._parent = r,
                        R.hasClass("pq-pending-refresh") && R.is(":visible") && (R.removeClass("pq-pending-refresh"), D.refresh())
                    }
                    e.refreshComplete = !0
                }
                return s
            }
        },
        renderCell: function(t) {
            var e, r = this.that.options.detailModel,
            n = t.cellData,
            i = t.rowData;
            if (!i.pq_gsummary && !i.pq_gtitle) return e = n && n.show ? r.expandIcon: r.collapseIcon,
            "<div class='ui-icon " + e + "'></div>"
        },
        rowExpand: function(t) {
            var e, r = this.that,
            n = r.normalize(t),
            i = r.options,
            o = n.rowData,
            a = n.rowIndxPage,
            l = i.detailModel,
            s = "pq_detail";
            if (o) {
                if (r._trigger("beforeRowExpand", null, n) === !1) return ! 1;
                e = o[s] = o[s] || {},
                e.show = !0,
                l.cache || this.rowInvalidate(n),
                this.softRefresh([[a, e.height || this.rowHtDetail]]),
                r.refreshRow(n)
            }
        },
        rowInvalidate: function(t) {
            var e = this.that,
            r = e.getRowData(t),
            n = "pq_detail",
            i = r[n],
            o = i ? i.child: null;
            o && (o.remove(), r[n].child = null)
        },
        rowCollapse: function(t) {
            var e = this.that,
            r = e.options,
            n = e.normalize(t),
            i = n.rowData,
            o = n.rowIndxPage,
            a = r.detailModel,
            l = "pq_detail",
            s = i ? i[l] : null;
            s && s.show && (a.cache || this.rowInvalidate(n), s.show = !1, this.softRefresh([[o, -(s.height || this.rowHtDetail)]]), e.refreshRow(n))
        },
        softRefresh: function(t) {
            var e = this.that.iRenderB;
            e.initRowHtArrDetailSuper(t),
            e.setPanes(),
            e.setCellDims(!0),
            e.refresh()
        },
        toggle: function(t, e) {
            var r, n = this.that,
            i = e.column,
            o = e.rowData,
            a = e.rowIndx,
            l = this.type;
            o.pq_gtitle || o.pq_gsummary || i && i.type === l && (r = o.pq_detail = o.pq_detail || {},
            n[r.show ? "rowCollapse": "rowExpand"]({
                rowIndx: a
            }))
        }
    }
} (jQuery),
function(t) {
    var e = function(t) {
        var e = this;
        e.that = t,
        e["class"] = "pq-grid-select-overlay",
        e.ranges = [],
        t.on("assignTblDims", e.onRefresh(e, t))
    };
    t.paramquery.cCells = e,
    e.prototype = {
        addBlock: function(t, e) {
            if (t && this.addUnique(this.ranges, t)) {
                var r = this.that,
                n = t.r1,
                i = t.c1,
                o = t.r2,
                a = t.c2,
                l = this.serialize(n, i, o, a) + " " + t.type,
                s = r.iRenderB,
                d = function(t, e) {
                    return s.getCellCont(t, e)
                },
                c = this.shiftRC(n, i, o, a);
                if (c) {
                    n = c[0],
                    i = c[1],
                    o = c[2],
                    a = c[3];
                    var u, h, f, p, g, v, m, w, x, y, C = d(n, i),
                    _ = d(o, a);
                    c = s.getCellXY(n, i),
                    g = c[0],
                    v = c[1],
                    c = s.getCellCoords(o, a),
                    m = c[2],
                    w = c[3],
                    x = w - v,
                    y = m - g,
                    C == _ ? this.addLayer(g, v, x, y, l, C) : (u = d(n, a), h = d(o, i), f = C[0].offsetWidth, p = C[0].offsetHeight, h == C ? (this.addLayer(g, v, x, f - g, l, C, "border-right:0;"), this.addLayer(0, v, x, m, l, _, "border-left:0;")) : C == u ? (this.addLayer(g, v, p - v, y, l, C, "border-bottom:0;"), this.addLayer(g, 0, w, y, l, _, "border-top:0;")) : (this.addLayer(g, v, p - v, f - g, l, C, "border-right:0;border-bottom:0"), this.addLayer(0, v, p - v, m, l, u, "border-left:0;border-bottom:0"), this.addLayer(g, 0, w, f - g, l, h, "border-right:0;border-top:0"), this.addLayer(0, 0, w, m, l, _, "border-left:0;border-top:0")))
                }
            }
        },
        addLayer: function(e, r, n, i, o, a, l) {
            var s = "position:absolute;left:" + e + "px;top:" + r + "px;height:" + n + "px;width:" + i + "px;z-index:1;";
            s += "pointer-events:none;",
            -1 == o.indexOf("cell") && (s += "border:1px solid #999;" + (l || "")),
            t("<svg class='" + this["class"] + " " + o + "' style='" + s + "'></svg>").appendTo(a)
        },
        addUnique: function(t, e) {
            var r = t.filter(function(t) {
                return e.r1 == t.r1 && e.c1 == t.c1 && e.r2 == t.r2 && e.c2 == t.c2
            })[0];
            return r ? void 0 : (t.push(e), !0)
        },
        getLastVisibleFrozenCI: function() {
            for (var t = this.that,
            e = t.colModel,
            r = t.options.freezeCols - 1; r >= 0; r--) if (!e[r].hidden) return r
        },
        getLastVisibleFrozenRIP: function() {
            for (var t = this.that,
            e = t.get_p_data(), r = t.riOffset, n = t.options.freezeRows + r - 1; n >= r; n--) if (!e[n].pq_hidden) return n - r
        },
        getSelection: function() {
            var t = this.that,
            e = t.get_p_data(),
            r = t.colModel,
            n = [];
            return this.ranges.forEach(function(t) {
                var i, o, a, l = t.r1,
                s = t.r2,
                d = t.c1,
                c = t.c2;
                for (o = l; s >= o; o++) for (i = e[o], a = d; c >= a; a++) n.push({
                    dataIndx: r[a].dataIndx,
                    colIndx: a,
                    rowIndx: o,
                    rowData: i
                })
            }),
            n
        },
        isSelected: function(t) {
            var e = this.that,
            r = e.normalize(t),
            n = r.rowIndx,
            i = r.colIndx;
            return null == i || null == n ? null: !!this.ranges.find(function(t) {
                var e = t.r1,
                r = t.r2,
                o = t.c1,
                a = t.c2;
                return n >= e && r >= n && i >= o && a >= i ? !0 : void 0
            })
        },
        onRefresh: function(t, e) {
            var r;
            return function() {
                clearTimeout(r),
                r = setTimeout(function() {
                    e.element && (t.removeAll(), e.Selection().address().forEach(function(e) {
                        t.addBlock(e)
                    }))
                },
                50)
            }
        },
        removeAll: function() {
            var t = this.that.$cont;
            t && t.children().children().children("svg").remove(),
            this.ranges = []
        },
        removeBlock: function(t) {
            if (t) {
                var e = t.r1,
                r = t.c1,
                n = t.r2,
                i = t.c2,
                o = this.ranges.findIndex(function(t) {
                    return e == t.r1 && r == t.c1 && n == t.r2 && i == t.c2
                });
                o >= 0 && (this.ranges.splice(o, 1), this.that.$cont.find("." + this["class"] + "." + this.serialize(e, r, n, i)).remove())
            }
        },
        serialize: function(t, e, r, n) {
            return "r1" + t + "c1" + e + "r2" + r + "c2" + n
        },
        shiftRC: function(t, e, r, n) {
            var i, o = this.that,
            a = o.iMerge,
            l = o.options,
            s = o.pdata.length,
            d = l.freezeRows,
            c = o.riOffset;
            return t -= c,
            r -= c,
            t = d > t ? Math.max(t, Math.min(0, r)) : t,
            t >= s || 0 > r ? void 0 : (r = Math.min(r, s - 1), t += c, r += c, a.ismergedCell(t, e) && (i = a.getRootCell(t, e), t = i.o_ri, e = i.o_ci), a.ismergedCell(r, n) && (i = a.getRootCell(r, n), r = i.o_ri + i.o_rc - 1, n = i.o_ci + i.o_cc - 1), t -= c, r -= c, t = Math.max(t, 0), r = Math.min(r, s - 1), n = Math.min(n, o.colModel.length - 1), [t, e, r, n])
        }
    }
} (jQuery),
function(t) {
    function e(t) {
        t.shiftKey && "pqGrid:mousePQUp" != t.type || (this._trigger("selectEnd", null, {
            selection: this.Selection()
        }), this.off("mousePQUp", e), this.off("keyUp", e))
    }
    t.paramquery.pqGrid.prototype.Range = function(t, e) {
        return new r.Range(this, t, "range", e)
    };
    var r = window.pq = window.pq || {};
    r.extend = function(t, e, r) {
        var n = function() {};
        n.prototype = t.prototype;
        var i = e.prototype = new n,
        o = t.prototype;
        for (var a in r) {
            var l = o[a],
            s = r[a];
            l ? i[a] = function(t, e) {
                return function() {
                    var r, n = this._super;
                    return this._super = function() {
                        return t.apply(this, arguments)
                    },
                    r = e.apply(this, arguments),
                    this._super = n,
                    r
                }
            } (l, s) : i[a] = s
        }
        i.constructor = e,
        i._base = t,
        i._bp = function(t) {
            var e = arguments;
            return Array.prototype.shift.call(e),
            o[t].apply(this, e)
        }
    };
    var n = r.Range = function(t, e, r, i) {
        if (null == t) throw "invalid param";
        return this.that = t,
        this._areas = [],
        this instanceof n == 0 ? new n(t, e, r, i) : (this._type = r || "range", void this.init(e, i))
    };
    n.prototype = t.extend({
        add: function(t) {
            this.init(t)
        },
        address: function() {
            return this._areas
        },
        addressLast: function() {
            var t = this.address();
            return t[t.length - 1]
        },
        clear: function() {
            return this.copy({
                copy: !1,
                cut: !0,
                source: "clear"
            })
        },
        clearOther: function(t) {
            var e, r = this._normal(t, !0),
            n = this.address();
            for (e = n.length - 1; e >= 0; e--) {
                var i = n[e];
                i.r1 == r.r1 && i.c1 == r.c1 && i.r2 == r.r2 && i.c2 == r.c2 || n.splice(e, 1)
            }
        },
        newLine: function(t) {
            return '"' + t.replace(/"/g, '""') + '"'
        },
        _copyArea: function(t, e, r, n, i, o, a, l, s, d, c) {
            var u, h, f, p, g, v, m, w, x = this.that,
            y = x.readCell,
            C = this.getRenderVal,
            _ = x.iMerge,
            I = [],
            b = x.riOffset,
            q = x.iRenderB;
            for (g = r; n >= g; g++) m = i[g],
            w = m.dataType,
            I[g] = !w || "string" == w || "html" == w;
            for (p = t; e >= p; p++) {
                var R = [],
                D = l[p],
                M = {},
                T = {},
                E = {
                    rowIndx: p,
                    rowIndxPage: p - b,
                    rowData: D,
                    Export: !0,
                    exportClip: !0
                };
                for (g = r; n >= g; g++) m = i[g],
                v = m.dataIndx,
                m.copy !== !1 && (u = D[v], d && (h = y(D, m, _, p, g), h === u && (E.colIndx = g, E.column = m, E.dataIndx = v, h = C(E, c, q)[0], I[g] && /(\r|\n)/.test(h) && (h = this.newLine(h))), R.push(h)), s && void 0 !== u && (M[v] = void 0, T[v] = u));
                s && a.push({
                    rowIndx: p,
                    rowData: D,
                    oldRow: T,
                    newRow: M
                }),
                f = R.join("	"),
                R = [],
                o.push(f)
            }
        },
        copy: function(t) {
            t = t || {};
            var e, r, n, i, o, a = this.that,
            l = t.dest,
            s = !!t.cut,
            d = null == t.copy ? !0 : t.copy,
            c = t.source || (s ? "cut": "copy"),
            u = t.history,
            h = t.allowInvalid,
            f = [],
            p = [],
            g = a.get_p_data(),
            v = a.colModel,
            m = t.render,
            w = this.address();
            if (u = null == u ? !0 : u, h = null == h ? !0 : h, m = null == m ? a.options.copyModel.render: m, w.length) {
                if (w.forEach(function(t) {
                    e = t.type,
                    r = t.r1,
                    n = t.c1,
                    i = "cell" === e ? r: t.r2,
                    o = "cell" === e ? n: t.c2,
                    this._copyArea(r, i, n, o, v, p, f, g, s, d, m)
                },
                this), d) {
                    var x = p.join("\n");
                    if (t.clip) {
                        var y = t.clip;
                        y.val(x),
                        y.select()
                    } else a._setGlobalStr(x)
                }
                if (l) a.paste({
                    dest: l,
                    rowList: f,
                    history: u,
                    allowInvalid: h
                });
                else if (s) {
                    var C = a._digestData({
                        updateList: f,
                        source: c,
                        history: u,
                        allowInvalid: h
                    });
                    C !== !1 && a.refresh({
                        source: "cut"
                    })
                }
            }
        },
        _countArea: function(t) {
            var e = t,
            r = t.type,
            n = e.r1,
            i = e.c1,
            o = e.r2,
            a = e.c2;
            return "cell" === r ? 1 : "row" === r ? 0 : (o - n + 1) * (a - i + 1)
        },
        count: function() {
            for (var t = "range" === this._type,
            e = this.address(), r = 0, n = e.length, i = 0; n > i; i++) r += t ? this._countArea(e[i]) : 1;
            return r
        },
        cut: function(t) {
            return t = t || {},
            t.cut = !0,
            this.copy(t)
        },
        getIndx: function(t) {
            return null == t ? this._areas.length - 1 : t
        },
        getValue: function() {
            var t, e, r, n, i, o, a, l, s, d, c = this.address(),
            u = [],
            h = this.that;
            if (c.length) {
                for (t = c[0], n = t.r1, i = t.c1, o = t.r2, a = t.c2, d = h.get_p_data(), l = n; o >= l; l++) for (e = d[l], s = i; a >= s; s++) r = e[h.colModel[s].dataIndx],
                u.push(r);
                return u
            }
        },
        hide: function(t) {
            t = t || {};
            var e, r = this.that,
            n = r.colModel,
            i = r.get_p_data(),
            o = this._areas;
            o.forEach(function(t) {
                var r = t.type,
                o = t.r1,
                a = t.r2,
                l = t.c1,
                s = t.c2;
                if ("column" === r) for (e = l; s >= e; e++) n[e].hidden = !0;
                else if ("row" === r) for (e = o; a >= e; e++) i[e].pq_hidden = !0
            }),
            t.refresh !== !1 && r.refreshView()
        },
        indexOf: function(t) {
            t = this._normal(t);
            for (var e, r = t.r1,
            n = t.c1,
            i = t.r2,
            o = t.c2,
            a = this.address(), l = 0, s = a.length; s > l; l++) if (e = a[l], "row" !== e.type && r >= e.r1 && i <= e.r2 && n >= e.c1 && o <= e.c2) return l;
            return - 1
        },
        index: function(t) {
            t = this._normal(t);
            for (var e, r = t.type,
            n = t.r1,
            i = t.c1,
            o = t.r2,
            a = t.c2,
            l = this.address(), s = 0, d = l.length; d > s; s++) if (e = l[s], r === e.type && n === e.r1 && o === e.r2 && i === e.c1 && a === e.c2) return s;
            return - 1
        },
        init: function(t, e) {
            if (e = e !== !1, t) if ("function" == typeof t.push) for (var r = 0,
            n = t.length; n > r; r++) this.init(t[r], e);
            else {
                var i = this._normal(t, e),
                o = this._areas = this._areas || [];
                i && o.push(i)
            }
        },
        merge: function(t) {
            t = t || {};
            var e, r, n = this.that,
            i = n.options,
            o = i.mergeCells,
            a = this._areas,
            l = a[0];
            l && (e = l.r2 - l.r1 + 1, r = l.c2 - l.c1 + 1, (e > 1 || r > 1) && (l.rc = e, l.cc = r, o.push(l), t.refresh !== !1 && n.refreshView()))
        },
        replace: function(t, e) {
            var r = this._normal(t),
            n = this._areas,
            i = this.getIndx(e);
            n.splice(i, 1, r)
        },
        remove: function(t) {
            var e = this._areas,
            r = this.indexOf(t);
            r >= 0 && e.splice(r, 1)
        },
        resize: function(t, e) {
            var r = this._normal(t),
            n = this._areas,
            i = this.getIndx(e),
            o = n[i];
            return ["r1", "c1", "r2", "c2", "rc", "cc", "type"].forEach(function(t) {
                o[t] = r[t]
            }),
            this
        },
        rows: function(t) {
            var e = this.that,
            n = [],
            i = this.addressLast();
            if (i) for (var o = i.r1,
            a = i.c1,
            l = i.r2,
            s = i.c2,
            d = i.type,
            c = null == t ? o: o + t, u = null == t ? l: o + t, h = c; u >= h; h++) n.push({
                r1: h,
                c1: a,
                r2: h,
                c2: s,
                type: d
            });
            return r.Range(e, n, "row")
        },
        _normal: function(t, e) {
            if (t.type) return t;
            var r;
            if ("function" == typeof t.push) {
                r = [];
                for (var n = 0,
                i = t.length; i > n; n++) {
                    var o = this._normal(t[n], e);
                    o && r.push(o)
                }
                return r
            }
            var a, l, s = this.that,
            d = s.get_p_data(),
            c = d.length - 1,
            u = s.colModel,
            h = u.length - 1,
            f = t.r1,
            p = t.c1,
            f = f > c ? c: f,
            p = p > h ? h: p,
            g = t.rc,
            v = t.cc,
            m = t.r2,
            w = t.c2,
            m = m > c ? c: m,
            w = w > h ? h: w,
            m = g ? f + g - 1 : m,
            w = v ? p + v - 1 : w;
            return 0 > h || 0 > c ? null: (f > m && (a = f, f = m, m = a), p > w && (a = p, p = w, w = a), null != f || null != p ? (null == f ? (f = 0, m = c, w = null == w ? p: w, l = "column") : null == p ? (!t._type, p = 0, m = null == m ? f: m, w = h, l = t._type || "row") : null == m || f == m && p == w ? (l = "cell", m = f, w = p) : l = "block", e && (r = s.iMerge.inflateRange(f, p, m, w), f = r[0], p = r[1], m = r[2], w = r[3]), t.r1 = f, t.c1 = p, t.r2 = m, t.c2 = w, t.type = t.type || l, t) : void 0)
        },
        select: function() {
            var t = this.that,
            e = t.iSelection,
            r = this._areas;
            return r.length && (e.removeAll({
                trigger: !1
            }), r.forEach(function(t) {
                e.add(t, !1)
            }), e.trigger()),
            this
        },
        unhide: function(t) {
            t = t || {};
            var e, r = this.that,
            n = r.colModel,
            i = r.get_p_data(),
            o = this._areas;
            o.forEach(function(t) {
                var r = t.type,
                o = t.r1,
                a = t.r2,
                l = t.c1,
                s = t.c2;
                if ("column" === r) for (e = l; s >= e; e++) n[e].hidden = !1;
                else if ("row" === r) for (e = o; a >= e; e++) i[e].pq_hidden = !1
            }),
            t.refresh !== !1 && r.refreshView()
        },
        unmerge: function(t) {
            t = t || {};
            var e = this.that,
            r = e.options,
            n = r.mergeCells,
            i = this._areas,
            o = i[0];
            if (o) {
                for (var a = 0; a < n.length; a++) {
                    var l = n[a];
                    if (l.r1 === o.r1 && l.c1 === o.c1) {
                        n.splice(a, 1);
                        break
                    }
                }
                t.refresh !== !1 && e.refreshView()
            }
        },
        value: function(t) {
            var e, r, n, i, o, a = 0,
            l = this.that,
            s = l.colModel,
            d = [],
            c = this.address();
            if (void 0 === t) return this.getValue();
            for (var u = 0; u < c.length; u++) {
                e = c[u],
                r = e.r1,
                n = e.c1,
                i = e.r2,
                o = e.c2;
                for (var h = r; i >= h; h++) {
                    for (var f = l.normalize({
                        rowIndx: h
                    }), p = f.rowData, g = f.rowIndx, v = {},
                    m = {},
                    w = n; o >= w; w++) {
                        var x = s[w].dataIndx;
                        m[x] = t[a++],
                        v[x] = p[x]
                    }
                    d.push({
                        rowData: p,
                        rowIndx: g,
                        newRow: m,
                        oldRow: v
                    })
                }
            }
            return d.length && (l._digestData({
                updateList: d,
                source: "range"
            }), l.refresh()),
            this
        }
    },
    r.mixin.render);
    var i = r.Selection = function(e, r) {
        if (null == e) throw "invalid param";
        return this instanceof i == 0 ? new i(e, r) : (this._areas = [], this.that = e, this.iCells = new t.paramquery.cCells(e), void this._base(e, r))
    };
    r.extend(n, i, {
        add: function(t, e) {
            var r = this._normal(t, !0),
            n = this.iCells,
            i = this.indexOf(r);
            i >= 0 || (n.addBlock(r), this._super(r), e !== !1 && this.trigger())
        },
        clearOther: function(t) {
            var e = this.iCells,
            r = this._normal(t, !0);
            this.address().forEach(function(t) {
                t.r1 == r.r1 && t.c1 == r.c1 && t.r2 == r.r2 && t.c2 == r.c2 || e.removeBlock(t)
            }),
            this._super(r),
            this.trigger()
        },
        getSelection: function() {
            return this.iCells.getSelection()
        },
        isSelected: function(t) {
            return this.iCells.isSelected(t)
        },
        removeAll: function(t) {
            t = t || {},
            this._areas.length && (this.iCells.removeAll(), this._areas = [], t.trigger !== !1 && this.trigger())
        },
        resizeOrReplace: function(t, e) {
            this.resize(t, e) || this.replace(t, e)
        },
        replace: function(t, e) {
            var r = this.iCells,
            n = this._normal(t),
            i = this._areas,
            o = this.getIndx(e),
            a = i[o];
            r.removeBlock(a),
            r.addBlock(n),
            this._super(n, o),
            this.trigger()
        },
        resize: function(t, e) {
            var r = this._normal(t, !0),
            n = r.r1,
            i = r.c1,
            o = r.r2,
            a = r.c2,
            l = this._areas || [];
            if (!l.length) return ! 1;
            var s = this.getIndx(e),
            d = l[s],
            c = d.r1,
            u = d.c1,
            h = d.r2,
            f = d.c2,
            p = c === n && u === i,
            g = c === n && f === a,
            v = h === o && u === i,
            m = h === o && f === a;
            return p && g && v && m ? !0 : void 0
        },
        selectAll: function(t) {
            t = t || {};
            var e, r = t.type,
            n = this.that,
            i = n.colModel,
            o = t.all,
            a = o ? 0 : n.riOffset,
            l = o ? n.get_p_data().length: n.pdata.length,
            s = i.length - 1,
            d = a + l - 1;
            return "row" === r ? (e = {
                r1: a,
                r2: d
            },
            n.Range(e).select()) : (e = {
                r1: a,
                c1: 0
            },
            e.r2 = d, e.c2 = s, n.Range(e).select()),
            this
        },
        trigger: function() {
            var t = this.that;
            t._trigger("selectChange", null, {
                selection: this
            }),
            t.off("mousePQUp", e),
            t.off("keyUp", e),
            t.on("mousePQUp", e),
            t.on("keyUp", e)
        }
    })
} (jQuery),
function(t) {
    var e = t.paramquery,
    r = {};
    r.options = {
        items: [],
        gridInstance: null
    },
    t.widget("paramquery.pqToolbar", r),
    r = e.pqToolbar.prototype,
    r.refresh = function() {
        this.element.empty(),
        this._create()
    },
    r._create = function() {
        var r, n, i = this.options,
        o = i.gridInstance,
        a = {
            button: "click",
            select: "change",
            checkbox: "change",
            textbox: "change",
            file: "change"
        },
        l = i.bootstrap,
        s = l.on,
        d = o.colModel,
        c = i.items,
        u = this.element;
        u.addClass("pq-toolbar");
        for (var h = 0,
        f = c.length; f > h; h++) {
            var p, g, v = c[h],
            m = v.type,
            w = v.value,
            x = v.icon,
            y = v.options || {},
            C = v.label,
            n = v.listener,
            _ = n ? [n] : v.listeners,
            _ = _ || [function() {}],
            I = v.cls,
            b = I ? I: "",
            b = s && "button" == m ? l.btn + " " + b: b,
            b = b ? "class='" + b + "'": "",
            q = v.style,
            R = q ? "style='" + q + "'": "",
            D = v.attr,
            M = D ? D: "",
            T = C && "button" != m && "file" != m ? [b, M] : [b, M, R],
            T = T.join(" ");
            if (v.options = y, "textbox" == m) g = t([C ? "<label " + R + ">" + C: "", "<input type='text' " + T + ">", C ? "</label>": ""].join(""));
            else if ("file" == m) g = t(["<label class='btn btn-default' " + T + ">", C || "File", "<input type='file' style='display:none;'>", "</label>"].join(""));
            else if ("textarea" == m) g = t([C ? "<label " + R + ">" + C: "", "<textarea " + T + "></textarea>", C ? "</label>": ""].join(""));
            else if ("checkbox" == m) g = t([C ? "<label " + R + ">": "", "<input type='checkbox' ", w ? "checked='checked' ": "", T, ">", C ? C + "</label>": ""].join(""));
            else if ("separator" == m) g = t("<span class='pq-separator' " + [M, R].join(" ") + "></span>");
            else if ("button" == m) {
                var E = "";
                s && (E = x ? "<span class='glyphicon " + x + "'></span>": ""),
                g = t("<button type='button' " + T + ">" + E + C + "</button>"),
                t.extend(y, {
                    label: C ? C: !1,
                    icons: {
                        primary: s ? "": x
                    }
                }),
                g.button(y)
            } else "select" == m ? ("function" == typeof y && (y = y.call(o, {
                colModel: d
            })), y = y || [], p = e.select({
                options: y,
                attr: T,
                prepend: v.prepend,
                groupIndx: v.groupIndx,
                valueIndx: v.valueIndx,
                labelIndx: v.labelIndx
            }), g = t([C ? "<label " + R + ">" + C: "", p, C ? "</label>": ""].join(""))) : "string" == typeof m ? g = t(m) : "function" == typeof m && (p = m.call(o, {
                colModel: d,
                cls: b
            }), g = t(p));
            g.appendTo(u),
            "checkbox" !== m && void 0 !== w && (C ? t(g[0].children[0]).val(w) : g.val(w));
            for (var S = 0,
            P = _.length; P > S; S++) {
                n = _[S];
                var k = {};
                "function" == typeof n ? k[a[m]] = n: k = n;
                for (r in k) g.on(r, this._onEvent(o, k[r], v))
            }
        }
    },
    r._onEvent = function(e, r, n) {
        return function(i) {
            "checkbox" == n.type ? n.value = t(i.target).prop("checked") : n.value = t(i.target).val(),
            r.call(e, i)
        }
    },
    r._destroy = function() {
        this.element.empty().removeClass("pq-toolbar").enableSelection()
    },
    r._disable = function() {
        null == this.$disable && (this.$disable = t("<div class='pq-grid-disable'></div>").css("opacity", .2).appendTo(this.element))
    },
    r._enable = function() {
        this.$disable && (this.element[0].removeChild(this.$disable[0]), this.$disable = null)
    },
    r._setOption = function(t, e) {
        "disabled" == t && (1 == e ? this._disable() : this._enable())
    },
    pq.toolbar = function(e, r) {
        var n = t(e).pqToolbar(r),
        i = n.data("paramqueryPqToolbar") || n.data("paramquery-pqToolbar");
        return i
    }
} (jQuery),
function(t) {
    var e = t.paramquery,
    r = e.pqGrid.prototype;
    r.options.trackModel = {
        on: !1,
        dirtyClass: "pq-cell-dirty"
    },
    e.cUCData = function(t) {
        this.that = t,
        this.udata = [],
        this.ddata = [],
        this.adata = [],
        this.options = t.options,
        t.on("dataAvailable", this.onDA(this))
    },
    e.cUCData.prototype = {
        add: function(t) {
            for (var e = this.that,
            r = this.adata,
            n = this.ddata,
            i = t.rowData,
            o = this.options.trackModel,
            a = o.dirtyClass,
            l = e.getRecId({
                rowData: i
            }), s = 0, d = r.length; d > s; s++) {
                var c = r[s];
                if (null != l && c.recId == l) throw "primary key violation";
                if (c.rowData == i) throw "same data can't be added twice."
            }
            for (var s = 0,
            d = n.length; d > s; s++) if (i == n[s].rowData) return void n.splice(s, 1);
            var u = [];
            for (var h in i) u.push(h);
            e.removeClass({
                rowData: i,
                dataIndx: u,
                cls: a
            });
            var t = {
                recId: l,
                rowData: i
            };
            r.push(t)
        },
        commit: function(t) {
            var e = this.that;
            if (null == t) this.commitAddAll(),
            this.commitUpdateAll(),
            this.commitDeleteAll();
            else {
                var r = t.history,
                n = e.options.dataModel,
                i = [],
                o = n.recIndx,
                a = t.type,
                l = t.rows;
                r = null == r ? !1 : r,
                "add" == a ? l ? i = this.commitAdd(l, o) : this.commitAddAll() : "update" == a ? l ? this.commitUpdate(l, o) : this.commitUpdateAll() : "delete" == a && (l ? this.commitDelete(l, o) : this.commitDeleteAll()),
                i.length && (e._digestData({
                    source: "commit",
                    checkEditable: !1,
                    track: !1,
                    history: r,
                    updateList: i
                }), e.refreshView())
            }
        },
        commitAdd: function(e, r) {
            var n, i, o, a, l, s, d = this.that,
            c = d.colModel,
            u = c.length,
            h = this.adata,
            f = t.inArray,
            p = h.length,
            g = d.getValueFromDataType,
            v = [],
            m = e.length,
            w = [];
            for (i = 0; m > i; i++) for (l = e[i], n = 0; p > n; n++) if (a = h[n].rowData, s = !0, -1 == f(a, w)) {
                for (o = 0; u > o; o++) {
                    var x = c[o],
                    y = x.dataType,
                    C = x.dataIndx;
                    if (!x.hidden && C != r) {
                        var _ = a[C],
                        _ = g(_, y),
                        I = l[C],
                        I = g(I, y);
                        if (_ !== I) {
                            s = !1;
                            break
                        }
                    }
                }
                if (s) {
                    var b = {},
                    q = {};
                    b[r] = l[r],
                    q[r] = a[r],
                    v.push({
                        rowData: a,
                        oldRow: q,
                        newRow: b
                    }),
                    w.push(a);
                    break
                }
            }
            var R = [];
            for (n = 0; p > n; n++) a = h[n].rowData,
            -1 == f(a, w) && R.push(h[n]);
            return this.adata = R,
            v
        },
        commitDelete: function(t, e) {
            for (var r, n, i, o, a = this.ddata,
            l = a.length,
            s = this.udata; l--&&(r = a[l].rowData, n = r[e], i = t.length);) for (; i--;) if (n == t[i][e]) {
                for (t.splice(i, 1), a.splice(l, 1), o = s.length; o--;) s[o].rowData == r && s.splice(o, 1);
                break
            }
        },
        commitUpdate: function(e, r) {
            var n, i, o = this.that,
            a = this.options.trackModel.dirtyClass,
            l = this.udata,
            s = l.length,
            d = e.length,
            c = [];
            for (n = 0; s > n; n++) {
                var u = l[n],
                h = u.rowData,
                f = u.oldRow;
                if ( - 1 == t.inArray(h, c)) for (i = 0; d > i; i++) {
                    var p = e[i];
                    if (h[r] == p[r]) {
                        c.push(h);
                        for (var g in f) o.removeClass({
                            rowData: h,
                            dataIndx: g,
                            cls: a
                        })
                    }
                }
            }
            var v = [];
            for (n = 0; s > n; n++) h = l[n].rowData,
            -1 == t.inArray(h, c) && v.push(l[n]);
            this.udata = v
        },
        commitAddAll: function() {
            this.adata = []
        },
        commitDeleteAll: function() {
            for (var t, e = this.ddata,
            r = this.udata,
            n = r.length,
            i = e.length,
            o = 0; n > 0 && i > o; o++) {
                for (t = e[o].rowData; n--;) r[n].rowData == t && r.splice(n, 1);
                n = r.length
            }
            e.length = 0
        },
        commitUpdateAll: function() {
            for (var t = this.that,
            e = this.options.trackModel.dirtyClass,
            r = this.udata,
            n = 0,
            i = r.length; i > n; n++) {
                var o = r[n],
                a = o.oldRow,
                l = o.rowData;
                for (var s in a) t.removeClass({
                    rowData: l,
                    dataIndx: s,
                    cls: e
                })
            }
            this.udata = []
        },
        "delete": function(t) {
            for (var e = this.that,
            r = t.rowIndx,
            n = t.rowIndxPage,
            i = e.riOffset,
            r = null == r ? n + i: r, n = null == n ? r - i: n, o = e.options.pageModel.type, a = "remote" == o ? n: r, l = this.adata, s = this.ddata, d = e.getRowData(t), c = 0, u = l.length; u > c; c++) if (l[c].rowData == d) return void l.splice(c, 1);
            s.push({
                indx: a,
                rowData: d,
                rowIndx: r
            })
        },
        getChangesValue: function(e) {
            e = e || {};
            for (var r = this.that,
            n = e.all,
            i = this.udata,
            o = this.adata,
            a = this.ddata,
            l = [], s = [], d = [], c = [], u = [], h = [], f = 0, p = a.length; p > f; f++) {
                var g = a[f],
                v = g.rowData,
                m = {};
                u.push(v);
                for (var w in v) 0 != w.indexOf("pq_") && (m[w] = v[w]);
                h.push(m)
            }
            for (var f = 0,
            p = i.length; p > f; f++) {
                var g = i[f],
                x = g.oldRow,
                v = g.rowData;
                if ( - 1 == t.inArray(v, u) && -1 == t.inArray(v, l)) {
                    var m = {};
                    if (n !== !1) for (var w in v) 0 != w.indexOf("pq_") && (m[w] = v[w]);
                    else {
                        for (var w in x) m[w] = v[w];
                        m[r.options.dataModel.recIndx] = g.recId
                    }
                    l.push(v),
                    s.push(m),
                    d.push(x)
                }
            }
            for (var f = 0,
            p = o.length; p > f; f++) {
                var g = o[f],
                v = g.rowData,
                m = {};
                for (var w in v) 0 != w.indexOf("pq_") && (m[w] = v[w]);
                c.push(m)
            }
            return {
                updateList: s,
                addList: c,
                deleteList: h,
                oldList: d
            }
        },
        getChanges: function() {
            for (var e = (this.that, this.udata), r = this.adata, n = this.ddata, i = t.inArray, o = [], a = [], l = [], s = [], d = 0, c = n.length; c > d; d++) {
                var u = n[d],
                h = u.rowData;
                s.push(h)
            }
            for (var d = 0,
            c = e.length; c > d; d++) {
                var u = e[d],
                f = u.oldRow,
                h = u.rowData; - 1 == i(h, s) && -1 == i(h, o) && (o.push(h), a.push(f))
            }
            for (var d = 0,
            c = r.length; c > d; d++) {
                var u = r[d],
                h = u.rowData;
                l.push(h)
            }
            return {
                updateList: o,
                addList: l,
                deleteList: s,
                oldList: a
            }
        },
        getChangesRaw: function() {
            var t = (this.that, this.udata),
            e = this.adata,
            r = this.ddata,
            n = {
                updateList: [],
                addList: [],
                deleteList: []
            };
            return n.updateList = t,
            n.addList = e,
            n.deleteList = r,
            n
        },
        isDirty: function(t) {
            var e = this.that,
            r = this.udata,
            n = this.adata,
            i = this.ddata,
            o = !1,
            a = e.getRowData(t);
            if (a) for (var l = 0; l < r.length; l++) {
                var s = r[l];
                if (a == s.rowData) {
                    o = !0;
                    break
                }
            } else(r.length || n.length || i.length) && (o = !0);
            return o
        },
        onDA: function(t) {
            return function(e, r) {
                "filter" != r.source && (t.udata = [], t.ddata = [], t.adata = [])
            }
        },
        rollbackAdd: function(t, e) {
            for (var r = this.adata,
            n = [], i = (t.type, 0), o = r.length; o > i; i++) {
                var a = r[i],
                l = a.rowData;
                n.push({
                    type: "delete",
                    rowData: l
                })
            }
            return this.adata = [],
            n
        },
        rollbackDelete: function(t, e) {
            for (var r = this.ddata,
            n = [], i = (t.type, r.length - 1); i >= 0; i--) {
                var o = r[i],
                a = (o.indx, o.rowIndx),
                l = o.rowData;
                n.push({
                    type: "add",
                    rowIndx: a,
                    newRow: l
                })
            }
            return this.ddata = [],
            n
        },
        rollbackUpdate: function(t, e) {
            for (var r = this.that,
            n = this.options.trackModel.dirtyClass,
            i = this.udata,
            o = [], a = 0, l = i.length; l > a; a++) {
                var s = i[a],
                d = s.recId,
                c = s.rowData,
                u = {},
                h = s.oldRow;
                if (null != d) {
                    var f = [];
                    for (var p in h) u[p] = c[p],
                    f.push(p);
                    r.removeClass({
                        rowData: c,
                        dataIndx: f,
                        cls: n,
                        refresh: !1
                    }),
                    o.push({
                        type: "update",
                        rowData: c,
                        newRow: h,
                        oldRow: u
                    })
                }
            }
            return this.udata = [],
            o
        },
        rollback: function(t) {
            var e = this.that,
            r = e.options.dataModel,
            n = e.options.pageModel,
            i = t && null != t.refresh ? t.refresh: !0,
            o = t && null != t.type ? t.type: null,
            a = [],
            l = [],
            s = [],
            d = r.data;
            null != o && "update" != o || (l = this.rollbackUpdate(n, d)),
            null != o && "delete" != o || (a = this.rollbackDelete(n, d)),
            null != o && "add" != o || (s = this.rollbackAdd(n, d)),
            e._digestData({
                history: !1,
                allowInvalid: !0,
                checkEditable: !1,
                source: "rollback",
                track: !1,
                addList: a,
                updateList: l,
                deleteList: s
            }),
            i && e.refreshView()
        },
        update: function(e) {
            var r = this.that,
            n = this.options.trackModel,
            i = n.dirtyClass,
            o = e.rowData || r.getRowData(e),
            a = r.getRecId({
                rowData: o
            }),
            l = e.dataIndx,
            s = e.refresh,
            d = r.columns,
            c = r.getValueFromDataType,
            u = e.row,
            h = this.udata,
            f = h.slice(0),
            p = !1;
            if (null != a) {
                for (var g = 0,
                v = h.length; v > g; g++) {
                    var m = h[g],
                    w = m.oldRow;
                    if (m.rowData == o) {
                        p = !0;
                        for (var l in u) {
                            var x = d[l],
                            y = x.dataType,
                            C = u[l],
                            C = c(C, y),
                            _ = w[l],
                            _ = c(_, y);
                            if (w.hasOwnProperty(l) && _ === C) {
                                var I = {
                                    rowData: o,
                                    dataIndx: l,
                                    refresh: s,
                                    cls: i
                                };
                                r.removeClass(I),
                                delete w[l]
                            } else {
                                var I = {
                                    rowData: o,
                                    dataIndx: l,
                                    refresh: s,
                                    cls: i
                                };
                                r.addClass(I),
                                w.hasOwnProperty(l) || (w[l] = o[l])
                            }
                        }
                        t.isEmptyObject(w) && f.splice(g, 1);
                        break
                    }
                }
                if (!p) {
                    var w = {};
                    for (var l in u) {
                        w[l] = o[l];
                        var I = {
                            rowData: o,
                            dataIndx: l,
                            refresh: s,
                            cls: i
                        };
                        r.addClass(I)
                    }
                    var I = {
                        rowData: o,
                        recId: a,
                        oldRow: w
                    };
                    f.push(I)
                }
                this.udata = f
            }
        }
    },
    r.getChanges = function(t) {
        if (this.blurEditor({
            force: !0
        }), t) {
            var e = t.format;
            if (e) {
                if ("byVal" == e) return this.iUCData.getChangesValue(t);
                if ("raw" == e) return this.iUCData.getChangesRaw()
            }
        }
        return this.iUCData.getChanges()
    },
    r.rollback = function(t) {
        this.blurEditor({
            force: !0
        }),
        this.iUCData.rollback(t)
    },
    r.isDirty = function(t) {
        return this.iUCData.isDirty(t)
    },
    r.commit = function(t) {
        this.iUCData.commit(t)
    },
    r.updateRow = function(t) {
        var e, r = this,
        n = t.rowList || [{
            rowIndx: t.rowIndx,
            newRow: t.newRow || t.row,
            rowData: t.rowData,
            rowIndxPage: t.rowIndxPage
        }],
        i = [];
        if (r.normalizeList(n).forEach(function(t) {
            var e, r = t.newRow,
            n = t.rowData,
            o = t.oldRow = {};
            if (n) {
                for (e in r) o[e] = n[e];
                i.push(t)
            }
        }), i.length) {
            var o = {
                source: t.source || "update",
                history: t.history,
                checkEditable: t.checkEditable,
                track: t.track,
                allowInvalid: t.allowInvalid,
                updateList: i
            },
            a = this._digestData(o);
            if (a === !1) return ! 1;
            t.refresh !== !1 && (i = o.updateList, e = i.length, e > 1 ? r.refresh() : 1 == e && r.refreshRow({
                rowIndx: i[0].rowIndx
            }))
        }
    },
    r.getRecId = function(t) {
        var e = this,
        r = e.options.dataModel;
        t.dataIndx = r.recIndx;
        var n = e.getCellData(t);
        return null == n ? null: n
    },
    r.getCellData = function(t) {
        var e = t.rowData || this.getRowData(t),
        r = t.dataIndx;
        return e ? e[r] : null
    },
    r.getRowData = function(t) {
        if (!t) return null;
        var e, r = t.rowData;
        if (null != r) return r;
        if (e = t.recId, null == e) {
            var n = t.rowIndx,
            n = null != n ? n: t.rowIndxPage + this.riOffset,
            i = this.get_p_data(),
            o = i[n];
            return o
        }
        for (var a = this.options,
        l = a.dataModel,
        s = l.recIndx,
        d = l.data,
        c = 0,
        u = d.length; u > c; c++) {
            var o = d[c];
            if (o[s] == e) return o
        }
        return null
    },
    r.deleteRow = function(t) {
        var e = this,
        r = e.normalizeList(t.rowList || [{
            rowIndx: t.rowIndx,
            rowIndxPage: t.rowIndxPage
        }]);
        return r.length ? (this._digestData({
            source: t.source || "delete",
            history: t.history,
            track: t.track,
            deleteList: r
        }), void(t.refresh !== !1 && e.refreshView())) : !1
    },
    r.addRow = function(t) {
        var e, r, n = this,
        i = n.riOffset,
        o = n.options.dataModel,
        a = o.data = o.data || [];
        return t.rowData && (t.newRow = t.rowData),
        null != t.rowIndxPage && (t.rowIndx = t.rowIndxPage + i),
        r = t.rowList || [{
            rowIndx: t.rowIndx,
            newRow: t.newRow
        }],
        r.length && this._digestData({
            source: t.source || "add",
            history: t.history,
            track: t.track,
            checkEditable: t.checkEditable,
            addList: r
        }) !== !1 ? (t.refresh !== !1 && this.refreshView(), e = r[0].rowIndx, null == e ? a.length - 1 : e) : !1
    }
} (jQuery),
function() {
    window.requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame ||
    function(t) {
        return setTimeout(t, 10)
    },
    window.cancelAnimationFrame = window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame ||
    function(t) {
        clearTimeout(t)
    }
} (),
function(t) {
    function e(t) {
        var e = this;
        e.that = t,
        t.on("mousePQUp", e.onMousePQUp.bind(e)).on("cellClick", e.onCellClick.bind(e)).on("cellMouseDown", e.onCellMouseDown.bind(e)).on("cellMouseEnter", e.onCellMouseEnter.bind(e)).on("refresh refreshRow", e.onRefresh.bind(e))
    }
    var r = t.paramquery;
    r.cMouseSelection = e,
    e.prototype = t.extend({
        onCellMouseDown: function(t, e) {
            var r = this.that,
            n = e.rowIndx,
            i = r.iSelection,
            o = e.colIndx,
            a = r.options.selectionModel,
            l = a.type,
            s = a.mode,
            d = i.addressLast();
            if ("cell" !== l) return void r.focus(e);
            if (null != o) {
                if ( - 1 == o) {
                    if (!a.row) return;
                    o = void 0
                }
                if (t.shiftKey && "single" !== s && d && null != d.firstR) {
                    var c = d.firstR,
                    u = d.firstC;
                    i.resizeOrReplace({
                        r1: c,
                        c1: u,
                        r2: n,
                        c2: o,
                        firstR: c,
                        firstC: u
                    })
                } else(t.ctrlKey || t.metaKey) && "single" !== s ? (this.mousedown = {
                    r1: n,
                    c1: o
                },
                r.Selection().add({
                    r1: n,
                    c1: o,
                    firstR: n,
                    firstC: o
                })) : (this.mousedown = {
                    r1: n,
                    c1: o
                },
                i.clearOther({
                    r1: n,
                    c1: o
                }), i.resizeOrReplace({
                    r1: n,
                    c1: o,
                    firstR: n,
                    firstC: o
                }));
                return r.focus(e),
                !0
            }
        },
        onCellMouseEnter: function(t, e) {
            var r = this.that,
            n = r.options.selectionModel,
            i = n.type,
            o = this.mousedown,
            a = n.mode;
            if (o && "single" !== a) {
                if ("cell" === i) {
                    var l = o.r1,
                    s = o.c1,
                    d = e.rowIndx,
                    c = e.colIndx,
                    u = r.Selection();
                    r.scrollCell({
                        rowIndx: d,
                        colIndx: c
                    }),
                    u.resizeOrReplace({
                        r1: l,
                        c1: s,
                        r2: d,
                        c2: c
                    })
                }
                r.focus(e)
            }
        },
        onCellClick: function(t, e) {
            var r, n = this.that,
            i = n.options.selectionModel,
            o = "single" == i.mode,
            a = i.toggle,
            l = n.iRows;
            if ("row" == i.type) {
                if (!i.row && -1 == e.colIndx) return;
                r = l.isSelected(e),
                o && !r || a || !t.metaKey && !t.ctrlKey ? !o && t.shiftKey ? l.extend(e) : !o || r && a ? (e.isFirst = !0, l[a ? "toggle": "add"](e)) : r || (l.removeAll(), l.add(e)) : (e.isFirst = !0, l.toggle(e))
            }
        },
        onMousePQUp: function() {
            this.mousedown = null
        },
        onRefresh: function() {
            var t = this.that;
            this.setTimer(function() {
                t.element && t.focus()
            },
            300)
        }
    },
    new r.cClass)
} (jQuery),
function(t) {
    var e = null,
    r = !1,
    n = "pq-grid-excel",
    i = t.paramquery,
    o = i.pqGrid.prototype;
    t.extend(o.options, {
        copyModel: {
            on: !0,
            render: !1,
            header: !0,
            zIndex: 1e4
        },
        cutModel: {
            on: !0
        },
        pasteModel: {
            on: !0,
            compare: "byVal",
            select: !0,
            validate: !0,
            allowInvalid: !0,
            type: "replace"
        }
    }),
    t.extend(o, {
        _setGlobalStr: function(t) {
            a.clip = t
        },
        copy: function() {
            return this.iSelection.copy()
        },
        cut: function() {
            return this.iSelection.copy({
                cut: !0,
                source: "cut"
            })
        },
        paste: function(t) {
            e = new a(this),
            e.paste(t),
            e = null
        },
        clear: function() {
            var t = this.iSelection;
            t.address().length ? t.clear() : this.iRows.toRange().clear()
        }
    });
    var a = i.cExcel = function(t, e) {
        this.that = t
    };
    a.clip = "",
    a.prototype = {
        createClipBoard: function() {
            var e = t("#pq-grid-excel-div"),
            r = this.that.options.copyModel,
            i = t("#" + n);
            0 == i.length && (e = t("<div id='pq-grid-excel-div'  style='position:fixed;top:20px;left:20px;height:1px;width:1px;overflow:hidden;z-index:" + r.zIndex + ";'/>").appendTo(document.body), i = t("<textarea id='" + n + "' autocomplete='off' spellcheck='false' style='overflow:hidden;height:10000px;width:10000px;opacity:0' />").appendTo(e), i.css({
                opacity: 0
            })),
            i.on("focusin",
            function(t) {
                t.stopPropagation()
            }),
            i.select()
        },
        destroyClipBoard: function() {
            this.clearClipBoard();
            var e = this.that,
            r = t(window).scrollTop(),
            n = t(window).scrollLeft();
            e.focus();
            var i = t(window).scrollTop(),
            o = t(window).scrollLeft();
            r == i && n == o || window.scrollTo(n, r)
        },
        clearClipBoard: function() {
            var e = t("#" + n);
            e.val("")
        },
        copy: function(t) {
            var e = this.that,
            r = e.iSelection;
            return r.address().length ? r.copy(t) : void e.iRows.toRange().copy(t)
        },
        getRows: function(t) {
            return t = t.replace(/\n$/, ""),
            t = t.replace(/(^|\t|\n)"(?=[^\t]*?[\r\n])([^"]|"")*"(?=$|\t|\n)/g,
            function(t) {
                return t.replace(/(\r\n|\n)/g, "\r").replace(/^(\t|\n)?"/, "$1").replace(/"$/, "").replace(/""/g, '"')
            }),
            t.split("\n")
        },
        paste: function(e) {
            e = e || {};
            var r = this.that,
            n = e.dest,
            i = e.clip,
            o = e.text || (i ? i.length ? i.val() : "": a.clip),
            l = this.getRows(o),
            s = l.length,
            d = r.colModel,
            c = r.options,
            u = r.readCell,
            h = c.pasteModel,
            f = "row",
            p = !1,
            g = d.length;
            if (h.on && 0 != o.length && 0 != s) {
                for (var v = 0; s > v; v++) l[v] = l[v].split("	");
                var m, w, x, y, C = h.type,
                _ = n ? r.Range(n) : r.Selection(),
                I = _.address(),
                b = I.length ? I: r.iRows.toRange().address(),
                q = b[0],
                R = {
                    rows: l,
                    areas: [q]
                };
                if (r._trigger("beforePaste", null, R) === !1) return ! 1;
                q && r.getRowData({
                    rowIndx: q.r1
                }) ? (f = "row" == q.type ? "row": "cell", m = q.r1, x = q.r2, w = q.c1, y = q.c2) : (f = "cell", m = 0, x = 0, w = 0, y = 0);
                var D, M;
                "replace" == C ? (D = m, M = s > x - m + 1 ? "extend": "repeat") : "append" == C ? (D = x + 1, M = "extend") : "prepend" == C && (D = m, M = "extend");
                var T, E, S, P = "extend" == M ? s: x - m + 1,
                k = 0,
                A = [],
                H = [],
                F = 0;
                for (v = 0; P > v; v++) {
                    var $ = l[k],
                    L = v + D,
                    V = "replace" == C ? r.getRowData({
                        rowIndx: L
                    }) : null,
                    O = V ? {}: null,
                    N = {};
                    void 0 === $ && "repeat" === M && (k = 0, $ = l[k]),
                    k++;
                    var z = $,
                    B = z.length;
                    if (!E) if ("cell" == f) {
                        if (T = B > y - w + 1 ? "extend": "repeat", E = "extend" == T ? B: y - w + 1, isNaN(E)) throw "lenH NaN. assert failed.";
                        E + w > g && (E = g - w)
                    } else E = g,
                    w = 0;
                    var U = 0,
                    W = 0,
                    j = 0;
                    for (S = E, W = 0; S > W; W++) {
                        U >= B && (U = 0);
                        var G = W + w,
                        K = d[G],
                        Q = z[U],
                        X = K.dataIndx;
                        K.copy !== !1 ? (U++, N[X] = Q, O && (O[X] = u(V, K))) : (j++, "extend" == T && g > S + w && S++)
                    }
                    0 == t.isEmptyObject(N) && (null == V ? (p = !0, A.push({
                        newRow: N,
                        rowIndx: L
                    })) : H.push({
                        newRow: N,
                        rowIndx: L,
                        rowData: V,
                        oldRow: O
                    }), F++)
                }
                var Y = {
                    addList: A,
                    updateList: H,
                    source: "paste",
                    allowInvalid: h.allowInvalid,
                    validate: h.validate
                };
                r._digestData(Y),
                r[p ? "refreshView": "refresh"](),
                h.select && r.Range({
                    r1: D,
                    c1: w,
                    r2: D + F - 1,
                    c2: "extend" == T ? w + E - 1 + j: y
                }).select(),
                r._trigger("paste", null, R)
            }
        }
    },
    t(document).unbind(".pqExcel").bind("keydown.pqExcel",
    function(i) {
        if (i.ctrlKey || i.metaKey) {
            var o = t(i.target);
            if (! (o.hasClass("pq-grid-row") || o.hasClass("pq-grid-cell") || o.is("#" + n) || o.hasClass("pq-body-outer"))) return;
            var s, d = o.closest(".pq-grid");
            if (e || o.length && d.length) {
                if (!e) {
                    try {
                        if (s = d.pqGrid("instance"), s.option("selectionModel.native")) return ! 0
                    } catch(c) {
                        return ! 0
                    }
                    e = new a(s, o),
                    e.createClipBoard()
                }
                if ("67" == i.keyCode || "99" == i.keyCode) e.copy({
                    clip: t("#" + n)
                });
                else if ("88" == i.keyCode) e.copy({
                    cut: !0,
                    clip: t("#" + n)
                });
                else if ("86" == i.keyCode || "118" == i.keyCode) r = !0,
                e.clearClipBoard(),
                window.setTimeout(function() {
                    e && (e.paste({
                        clip: t("#" + n)
                    }), e.destroyClipBoard(), e = null),
                    r = !1
                },
                0);
                else {
                    var u = t("#" + n);
                    if (u.length) {
                        var h = document.activeElement;
                        h == u[0] && e.that.onKeyPressDown(i)
                    }
                }
            }
        } else {
            var f = i.keyCode,
            p = t.ui.keyCode,
            g = f == p.UP || f == p.DOWN || f == p.LEFT || f == p.RIGHT || f == p.PAGE_UP || f == p.PAGE_DOWN;
            if (g) {
                if (l) return ! 1;
                o = t(i.target),
                (o.hasClass("pq-grid-row") || o.hasClass("pq-grid-cell")) && (l = !0)
            }
        }
    }).bind("keyup.pqExcel",
    function(n) {
        var i = n.keyCode;
        if (r || !e || n.ctrlKey || n.metaKey || -1 == t.inArray(i, [17, 91, 93, 224]) || (e.destroyClipBoard(), e = null), l) {
            var o = t(n.target);
            o.hasClass("pq-grid-row") || o.hasClass("pq-grid-cell") || (l = !1)
        }
    });
    var l = !1
} (jQuery),
function(t) {
    var e = t.paramquery,
    r = e.pqGrid.prototype.options,
    n = {
        on: !0,
        checkEditable: !0,
        checkEditableAdd: !1,
        allowInvalid: !0
    };
    r.historyModel = r.historyModel || n;
    var i = e.cHistory = function(t) {
        var e = this;
        this.that = t,
        this.options = t.options,
        this.records = [],
        this.counter = 0,
        this.id = 0,
        t.on("keyDown",
        function(t, r) {
            return e.onKeyDown(t, r)
        }).on("dataAvailable",
        function(t, r) {
            "filter" != r.source && e.reset()
        })
    };
    i.prototype = {
        onKeyDown: function(t, e) {
            var r = {
                z: "90",
                y: "89",
                c: "67",
                v: "86"
            },
            n = t.ctrlKey || t.metaKey;
            return n && t.keyCode == r.z ? (this.undo(), !1) : n && t.keyCode == r.y ? (this.redo(), !1) : void 0
        },
        resetUndo: function() {
            if (0 == this.counter) return ! 1;
            this.counter = 0;
            var t = this.that;
            t._trigger("history", null, {
                type: "resetUndo",
                num_undo: 0,
                num_redo: this.records.length - this.counter,
                canUndo: !1,
                canRedo: !0
            })
        },
        reset: function() {
            if (0 == this.counter && 0 == this.records.length) return ! 1;
            this.records = [],
            this.counter = 0,
            this.id = 0;
            var t = this.that;
            t._trigger("history", null, {
                num_undo: 0,
                num_redo: 0,
                type: "reset",
                canUndo: !1,
                canRedo: !1
            })
        },
        increment: function() {
            var t = this.records,
            e = t.length;
            if (e) {
                var r = t[e - 1].id;
                this.id = r + 1
            } else this.id = 0
        },
        push: function(e) {
            var r = this.canRedo(),
            n = this.records,
            i = this.counter;
            n.length > i && n.splice(i, n.length - i),
            n[i] = t.extend({
                id: this.id
            },
            e),
            this.counter++;
            var o, a, l = this.that;
            1 == this.counter && (o = !0),
            r && this.counter == n.length && (a = !1),
            l._trigger("history", null, {
                type: "add",
                canUndo: o,
                canRedo: a,
                num_undo: this.counter,
                num_redo: 0
            })
        },
        canUndo: function() {
            return this.counter > 0
        },
        canRedo: function() {
            return this.counter < this.records.length
        },
        processCol: function(t, e) {
            var r = this.that;
            if (t.length) {
                var n = "add" == t.type,
                n = e ? n: !n;
                r[n ? "addColumn": "deleteColumn"]({
                    colList: t,
                    history: !1
                })
            }
        },
        undo: function() {
            var t = this.canRedo(),
            e = this.that,
            r = this.options.historyModel,
            n = this.records;
            if (! (this.counter > 0)) return ! 1;
            this.counter--;
            var i, o, a = this.counter,
            l = n[a],
            s = l.colList || [],
            d = (l.id, l.updateList.map(function(t) {
                return {
                    rowIndx: e.getRowIndx({
                        rowData: t.rowData
                    }).rowIndx,
                    rowData: t.rowData,
                    oldRow: t.newRow,
                    newRow: t.oldRow
                }
            })),
            c = l.addList.map(function(t) {
                return {
                    rowData: t.newRow
                }
            }),
            u = l.deleteList.map(function(t) {
                return {
                    newRow: t.rowData,
                    rowIndx: t.rowIndx
                }
            });
            if (s.length) this.processCol(s);
            else {
                e._digestData({
                    history: !1,
                    source: "undo",
                    checkEditable: r.checkEditable,
                    checkEditableAdd: r.checkEditableAdd,
                    allowInvalid: r.allowInvalid,
                    addList: u,
                    updateList: d,
                    deleteList: c
                });
                e[u.length || c.length ? "refreshView": "refresh"]({
                    source: "undo"
                })
            }
            return t === !1 && (i = !0),
            0 == this.counter && (o = !1),
            e._trigger("history", null, {
                canUndo: o,
                canRedo: i,
                type: "undo",
                num_undo: this.counter,
                num_redo: this.records.length - this.counter
            }),
            !0
        },
        redo: function() {
            var t = this.canUndo(),
            e = this.that,
            r = this.options.historyModel,
            n = this.counter,
            i = this.records;
            if (n == i.length) return ! 1;
            var o = i[n],
            a = o.colList || [],
            l = (o.id, o.updateList.map(function(t) {
                return {
                    rowIndx: e.getRowIndx({
                        rowData: t.rowData
                    }).rowIndx,
                    rowData: t.rowData,
                    newRow: t.newRow,
                    oldRow: t.oldRow
                }
            })),
            s = o.deleteList.map(function(t) {
                return {
                    rowData: t.rowData
                }
            }),
            d = o.addList.map(function(t) {
                return {
                    newRow: t.newRow,
                    rowIndx: t.rowIndx
                }
            });
            if (a.length) this.processCol(a, !0);
            else {
                e._digestData({
                    history: !1,
                    source: "redo",
                    checkEditable: r.checkEditable,
                    checkEditableAdd: r.checkEditableAdd,
                    allowInvalid: r.allowInvalid,
                    addList: d,
                    updateList: l,
                    deleteList: s
                });
                e[d.length || s.length ? "refreshView": "refresh"]({
                    source: "redo"
                })
            }
            this.counter < i.length && this.counter++;
            var c, u;
            return 0 == t && (c = !0),
            this.counter == this.records.length && (u = !1),
            e._trigger("history", null, {
                canUndo: c,
                canRedo: u,
                type: "redo",
                num_undo: this.counter,
                num_redo: this.records.length - this.counter
            }),
            !0
        }
    };
    var o = e.pqGrid.prototype;
    o.history = function(t) {
        var e = t.method;
        return this.iHistory[e](t)
    },
    o.History = function() {
        return this.iHistory
    }
} (jQuery),
function(t) {
    var e = t.paramquery;
    e.filter = function() {
        var t = {
            begin: {
                text: "Begins With",
                TR: !0,
                string: !0
            },
            between: {
                text: "Between",
                TR: !0,
                string: !0,
                date: !0,
                number: !0
            },
            notbegin: {
                text: "Does not begin with",
                TR: !0,
                string: !0
            },
            contain: {
                text: "Contains",
                TR: !0,
                string: !0
            },
            notcontain: {
                text: "Does not contain",
                TR: !0,
                string: !0
            },
            equal: {
                text: "Equal To",
                TR: !0,
                string: !0,
                bool: !0
            },
            notequal: {
                text: "Not Equal To",
                TR: !0,
                string: !0
            },
            empty: {
                text: "Empty",
                TR: !1,
                string: !0,
                bool: !0
            },
            notempty: {
                text: "Not Empty",
                TR: !1,
                string: !0,
                bool: !0
            },
            end: {
                text: "Ends With",
                TR: !0,
                string: !0
            },
            notend: {
                text: "Does not end with",
                TR: !0,
                string: !0
            },
            less: {
                text: "Less Than",
                TR: !0,
                number: !0,
                date: !0
            },
            lte: {
                text: "Less than or equal",
                TR: !0,
                number: !0,
                date: !0
            },
            range: {
                TR: !0,
                string: !0,
                number: !0,
                date: !0
            },
            regexp: {
                TR: !0,
                string: !0,
                number: !0,
                date: !0
            },
            great: {
                text: "Great Than",
                TR: !0,
                number: !0,
                date: !0
            },
            gte: {
                text: "Greater than or equal",
                TR: !0,
                number: !0,
                date: !0
            }
        };
        return {
            conditions: t,
            getAllConditions: function() {
                var e = [];
                for (var r in t) e.push(r);
                return e
            } (),
            getConditions: function(e) {
                var r = [];
                for (var n in t) t[n][e] && r.push(n);
                return r
            },
            getTRConditions: function() {
                var e = [];
                for (var r in t) t[r].TR && e.push(r);
                return e
            } (),
            getWTRConditions: function() {
                var e = [];
                for (var r in t) t[r].TR || e.push(r);
                return e
            } ()
        }
    } (),
    e.filter.rules = {},
    e.filter.rules.en = {
        begin: "Begins With",
        between: "Between",
        notbegin: "Does not begin with",
        contain: "Contains",
        notcontain: "Does not contain",
        equal: "Equal To",
        notequal: "Not Equal To",
        empty: "Empty",
        notempty: "Not Empty",
        end: "Ends With",
        notend: "Does not end with",
        less: "Less Than",
        lte: "Less than or equal",
        great: "Great Than",
        gte: "Greater than or equal"
    };
    var r = function(t) {
        this.that = t,
        t.on("load",
        function() {
            var e = t.options.dataModel.dataUF;
            e && (e.length = 0)
        }),
        this.isMatchCell = this.isMatchCellSingle
    };
    e.cFilterData = r,
    r.conditions = {
        equal: function(t, e) {
            return t == e ? !0 : void 0
        },
        contain: function(t, e) {
            return - 1 != t.indexOf(e) ? !0 : void 0
        },
        notcontain: function(t, e) {
            return - 1 == t.indexOf(e) ? !0 : void 0
        },
        empty: function(t) {
            return 0 == t.length ? !0 : void 0
        },
        notempty: function(t) {
            return t.length > 0 ? !0 : void 0
        },
        begin: function(t, e) {
            return 0 == (t + "").indexOf(e) ? !0 : void 0
        },
        notbegin: function(t, e) {
            return 0 != t.indexOf(e) ? !0 : void 0
        },
        end: function(t, e) {
            var r = t.lastIndexOf(e);
            return - 1 != r && r + e.length == t.length ? !0 : void 0
        },
        notend: function(t, e) {
            var r = t.lastIndexOf(e);
            return - 1 == r || r + e.length != t.length ? !0 : void 0
        },
        regexp: function(t, e) {
            return e.test(t) ? (e.lastIndex = 0, !0) : void 0
        },
        notequal: function(t, e) {
            return t != e ? !0 : void 0
        },
        great: function(t, e) {
            return t > e ? !0 : void 0
        },
        gte: function(t, e) {
            return t >= e ? !0 : void 0
        },
        between: function(t, e, r) {
            return t >= e && r >= t ? !0 : void 0
        },
        range: function(e, r) {
            return - 1 != t.inArray(e, r) ? !0 : void 0
        },
        less: function(t, e) {
            return e > t ? !0 : void 0
        },
        lte: function(t, e) {
            return e >= t ? !0 : void 0
        }
    },
    r.convert = function(e, r) {
        return e = null == e ? "": e,
        "string" == r ? e = t.trim(e).toUpperCase() : "date" == r ? e = Date.parse(e) : "integer" == r ? e = parseInt(e) : "float" == r ? e = parseFloat(e) : "bool" == r ? e = String(e).toLowerCase() : "html" == r && (e = t.trim(e).toUpperCase()),
        e
    },
    r.prototype = {
        isMatchCellSingle: function(t, e) {
            var n = t.dataIndx,
            i = t.dataType,
            o = t.value,
            a = t.value2,
            l = t.condition,
            s = t.cbFn,
            d = e[n];
            d = "regexp" == l ? null == d ? "": d: r.convert(d, i);
            var c = !!s(d, o, a);
            return c
        },
        isMatchRow: function(t, e, r) {
            if (0 == e.length) return ! 0;
            for (var n = 0; n < e.length; n++) {
                var i = e[n],
                o = this.isMatchCell(i, t);
                if ("OR" == r && o) return ! 0;
                if ("AND" == r && !o) return ! 1
            }
            return "AND" == r ? !0 : "OR" == r ? !1 : void 0
        },
        getQueryStringFilter: function() {
            var t = this.that,
            e = t.options,
            r = e.stringify,
            n = e.filterModel,
            i = n.mode,
            o = t.colModel,
            a = this.getRulesFromCM({
                CM: o,
                location: "remote"
            }),
            l = "";
            if (n && n.on && a) if (a.length) {
                var s = {
                    mode: i,
                    data: a
                };
                l = r === !1 ? s: JSON.stringify(s)
            } else l = "";
            return l
        },
        copyRuleToColumn: function(e, r) {
            var n = r.filter,
            i = e.condition,
            o = e.value;
            if (n ? n.on = !0 : n = r.filter = {
                on: !0
            },
            i && (n.condition = i), i = n.condition, n.value = o, "between" == i) n.value2 = e.value2;
            else if ("range" == i) {
                var a = [];
                if (o) if ("string" == typeof o) {
                    var l = n.options,
                    s = o.indexOf('"'),
                    d = o.lastIndexOf('"');
                    if (o = o.substr(s, d + 1), o = JSON.parse("[" + o + "]"), l) for (var c = 0,
                    u = l.length; u > c; c++) {
                        var h = l[c]; - 1 != t.inArray(h, o) && a.push(h)
                    } else a = o.split(",s*")
                } else "function" == typeof o.push && (a = o);
                n.value = a
            }
        },
        filterLocalData: function(t) {
            t = t || {};
            var e, r, n = this.that,
            i = t.data,
            o = !i,
            a = o ? n.colModel: t.CM,
            l = this.getRulesFromCM({
                CM: a
            }),
            s = n.options,
            d = s.dataModel,
            c = n.iSort,
            u = i || d.data,
            h = d.dataUF = d.dataUF || [],
            f = [],
            p = [],
            g = s.filterModel,
            v = (g.multiple, t.mode || g.mode);
            if (o) if (h.length) {
                r = !0;
                for (var m = 0,
                w = h.length; w > m; m++) u.push(h[m]);
                h = d.dataUF = []
            } else {
                if (!l.length) return {
                    data: u,
                    dataUF: h
                };
                c.saveOrder()
            }
            if (g.on && v && l && l.length) {
                if (u.length) if (e = {
                    filters: l,
                    mode: v,
                    data: u
                },
                n._trigger("customFilter", null, e) === !1) f = e.dataTmp,
                p = e.dataUF;
                else for (var m = 0,
                w = u.length; w > m; m++) {
                    var x = u[m];
                    this.isMatchRow(x, l, v) ? f.push(x) : p.push(x)
                }
                u = f,
                h = p,
                0 == c.readSorter().length && (u = c.sortLocalData(u)),
                o && (d.data = u, d.dataUF = h)
            } else r && o && (e = {
                data: u
            },
            n._trigger("clearFilter", null, e) === !1 && (u = e.data), 0 == c.readSorter().length && (u = c.sortLocalData(u)), d.data = u, n._queueATriggers.filter = {
                ui: {
                    type: "local"
                }
            });
            return o && (n._queueATriggers.filter = {
                ui: {
                    type: "local",
                    filter: l
                }
            }),
            {
                data: u,
                dataUF: h
            }
        },
        addMissingConditions: function(t) {
            var e = this.that;
            t.forEach(function(t) {
                t.condition = t.condition || e.getColumn({
                    dataIndx: t.dataIndx
                }).filter.condition
            })
        },
        getRulesFromCM: function(r) {
            var n = r.CM;
            if (!n) throw "CM N/A";
            for (var i = (this.that, n.length), o = 0, a = r.location, l = e.filter.getAllConditions, s = e.filter.getTRConditions, d = [], c = e.cFilterData, u = function(e, r, n) {
                return "function" == typeof e ? !0 : "between" == e ? null != r && "" !== r || null != n && "" !== n: -1 != t.inArray(e, l) ? null != r && "" !== r || -1 == t.inArray(e, s) : !0
            },
            h = function(t, e) {
                return "remote" == a ? (t = null == t ? "": t, t.toString()) : c.convert(t, e)
            }; i > o; o++) {
                var f = n[o],
                p = f.filter;
                if (p && p.on) {
                    var g = p.dataIndx || f.dataIndx,
                    v = f.dataType,
                    v = v && "stringi" != v && "function" != typeof v ? v: "string",
                    m = p.value,
                    w = p.value2,
                    x = p.condition;
                    if (u(x, m, w)) {
                        if ("between" == x)"" === m || null == m ? (x = "lte", m = h(w, v)) : "" === w || null == w ? (x = "gte", m = h(m, v)) : (m = h(m, v), w = h(w, v));
                        else if ("regexp" == x) {
                            if ("remote" == a) m = m.toString();
                            else if ("string" == typeof m) try {
                                var y = p.modifiers || "gi";
                                m = new RegExp(m, y)
                            } catch(C) {
                                m = /.*/
                            }
                        } else if ("range" == x) {
                            if (null == m) continue;
                            if ("string" == typeof m) m = h(m, v),
                            m = m.split(/\s*,\s*/);
                            else if (m && "function" == typeof m.push) {
                                if (0 == m.length) continue;
                                m = m.slice();
                                for (var _ = 0,
                                I = m.length; I > _; _++) m[_] = h(m[_], v)
                            }
                        } else m = h(m, v);
                        var b;
                        b = "remote" == a ? "": "function" == typeof x ? x: c.conditions[x],
                        d.push({
                            dataIndx: g,
                            value: m,
                            value2: w,
                            condition: x,
                            dataType: v,
                            cbFn: b
                        })
                    }
                }
            }
            return d
        },
        getCMFromRules: function(e) {
            var r = this.that;
            return e.map(function(e) {
                return t.extend(!0, {},
                r.getColumn({
                    dataIndx: e.dataIndx
                }))
            })
        },
        clearFilters: function(t) {
            t.forEach(function(t) {
                var e = t.filter;
                e && (e.value = e.value2 = void 0)
            })
        },
        filter: function(t) {
            t = t || {},
            this.compatibilityCheck(t);
            var e, r, n = this.that,
            i = n.options,
            o = !1,
            a = t.data,
            l = t.rules || [t.rule],
            s = !a,
            d = i.dataModel,
            c = i.filterModel,
            u = t.mode || c.mode,
            h = "replace" == t.oper,
            f = s ? n.colModel: this.getCMFromRules(l),
            p = 0,
            g = l.length;
            if (this.addMissingConditions(l), s) {
                if (n._trigger("beforeFilter", null, t) === !1) return;
                for (null != t.header && (o = t.header), h && this.clearFilters(f); g > p; p++) e = l[p],
                r = n.getColumn({
                    dataIndx: e.dataIndx
                }),
                this.copyRuleToColumn(e, r)
            } else for (; g > p; p++) e = l[p],
            r = f[p],
            this.copyRuleToColumn(e, r);
            var v = {
                header: o,
                CM: f,
                data: a,
                rules: l,
                mode: u
            };
            return "remote" != d.location || "local" == c.type ? (v.source = "filter", v.trigger = !1, n._onDataAvailable(v)) : void n.remoteRequest({
                apply: s,
                CM: f,
                callback: function() {
                    return n._onDataAvailable(v)
                }
            })
        },
        compatibilityCheck: function(t) {
            var e, r = t.data,
            n = "Incorrect filter parameters. Please check upgrade guide";
            if (r) if (e = r[0]) {
                if (e.hasOwnProperty("dataIndx") && e.hasOwnProperty("value")) throw n
            } else if (!t.rules) throw n
        }
    }
} (jQuery),
function(t) {
    var e = t.paramquery,
    r = e.cSort = function(t) {
        var e = this;
        e.that = t,
        e.sorters = [],
        e.tmpPrefix = "pq_tmp_",
        e.cancel = !1
    };
    e.pqGrid.prototype.sort = function(t) {
        t = t || {};
        var e = this,
        r = this.options,
        n = r.dataModel,
        i = n.data,
        o = r.sortModel,
        a = o.type;
        if (i && i.length || "local" != a) {
            var l, s = r.editModel,
            d = this.iSort,
            c = d.getSorter(),
            u = t.evt,
            h = null == t.single ? d.readSingle() : t.single,
            f = d.readCancel();
            if (t.sorter ? t.addon ? (t.single = h, t.cancel = f, l = d.addon(t)) : l = t.sorter: l = d.readSorter(), l.length || c.length) {
                s.indices && e.blurEditor({
                    force: !0
                });
                var p = {
                    dataIndx: l.length ? l[0].dataIndx: null,
                    oldSorter: c,
                    sorter: l,
                    source: t.source,
                    single: h
                };
                if (e._trigger("beforeSort", u, p) === !1) return void d.cancelSort();
                d.resumeSort(),
                "local" == a && d.saveOrder(),
                d.setSorter(l),
                d.setSingle(h),
                d.writeSorter(l),
                d.writeSingle(h),
                "local" == a ? (n.data = d.sortLocalData(i), this._queueATriggers.sort = {
                    evt: u,
                    ui: p
                },
                t.refresh !== !1 && this.refreshView()) : "remote" == a && (this._queueATriggers.sort = {
                    evt: u,
                    ui: p
                },
                t.initByRemote || this.remoteRequest({
                    initBySort: !0,
                    callback: function() {
                        e._onDataAvailable()
                    }
                }))
            }
        }
    },
    r.prototype = {
        addon: function(e) {
            e = e || {};
            var r = e.sorter[0],
            n = r.dataIndx,
            i = r.dir,
            o = e.single,
            a = e.cancel,
            l = this.readSorter(),
            s = l[0];
            if (null == o) throw "sort single N/A";
            if (null != n) if (o && !e.tempMultiple) if (l = l.length ? [l[0]] : [], s = l[0], s && s.dataIndx == r.dataIndx) {
                var d = s.dir,
                c = "up" === d ? "down": a && "down" === d ? "": "up";
                "" === c ? l.length--:s.dir = c
            } else c = i || "up",
            l[0] = t.extend({},
            r, {
                dir: c
            });
            else {
                var u = this.inSorters(l, n);
                u > -1 ? (d = l[u].dir, "up" == d ? l[u].dir = "down": a && "down" == d ? l.splice(u, 1) : 1 == l.length ? l[u].dir = "up": l.splice(u, 1)) : l.push(t.extend({},
                r, {
                    dir: "up"
                }))
            }
            return l
        },
        cancelSort: function() {
            this.cancel = !0
        },
        resumeSort: function() {
            this.cancel = !1
        },
        readSorter: function() {
            var t, e = this.that,
            r = e.options,
            n = e.columns,
            i = [],
            o = r.sortModel,
            a = o.sorter;
            if (a && (t = a.length)) {
                for (; t--;) null == n[a[t].dataIndx] && a.splice(t, 1);
                i = i.concat(a)
            }
            return i = pq.arrayUnique(i, "dataIndx")
        },
        setSingle: function(t) {
            this.single = t
        },
        getSingle: function() {
            return this.single
        },
        readSingle: function() {
            return this.that.options.sortModel.single
        },
        setCancel: function(t) {
            this.cancel = t
        },
        readCancel: function() {
            return this.that.options.sortModel.cancel
        },
        saveOrder: function(t) {
            var e = this.that,
            r = e.options.dataModel,
            t = r.data;
            if (t && t.length && !(r.dataUF && r.dataUF.length || this.getSorter().length && null != t[0].pq_order)) for (var n = 0,
            i = t.length; i > n; n++) t[n].pq_order = n
        },
        getCancel: function() {
            return this.cancel
        },
        getQueryStringSort: function() {
            if (this.cancel) return "";
            var t = this.that,
            e = this.sorters,
            r = t.options,
            n = r.stringify;
            return e.length ? n === !1 ? e: JSON.stringify(e) : ""
        },
        getSorter: function() {
            return this.sorters
        },
        setSorter: function(t) {
            this.sorters = t.slice(0)
        },
        inSorters: function(t, e) {
            for (var r = 0; r < t.length; r++) if (t[r].dataIndx == e) return r;
            return - 1
        },
        sortLocalData: function(t) {
            var e = this.sorters;
            return e.length || (e = [{
                dataIndx: "pq_order",
                dir: "up",
                dataType: "integer"
            }]),
            this._sortLocalData(e, t)
        },
        compileSorter: function(t, e) {
            var r = this,
            i = r.that,
            o = i.columns,
            a = i.options,
            l = [],
            s = [],
            d = [],
            c = r.tmpPrefix,
            u = a.sortModel,
            h = u.useCache,
            f = u.ignoreCase,
            p = t.length;
            e = e ? e: a.dataModel.data;
            for (var g = 0; p > g; g++) {
                var v = t[g],
                m = v.sortIndx || v.dataIndx,
                w = o[m] || {},
                x = v.dir = v.dir || "up",
                y = "up" == x ? 1 : -1,
                C = w.sortType,
                C = pq.getFn(C),
                _ = w.dataType || v.dataType || "string",
                _ = "string" == _ && f ? "stringi": _,
                I = h && "date" == _,
                b = I ? c + m: m;
                s[g] = b,
                d[g] = y,
                C ? l[g] = function(t, e) {
                    return function(r, n, i, o) {
                        return e(r, n, i, o, t)
                    }
                } (C, n.sort_sortType) : "integer" == _ ? l[g] = n.sort_number: "float" == _ ? l[g] = n.sort_number: "function" == typeof _ ? l[g] = function(t, e) {
                    return function(r, n, i, o) {
                        return e(r, n, i, o, t)
                    }
                } (_, n.sort_dataType) : "date" == _ ? l[g] = n["sort_date" + (I ? "_fast": "")] : "bool" == _ ? l[g] = n.sort_bool: "stringi" == _ ? l[g] = n.sort_locale: l[g] = n.sort_string,
                I && r.useCache(e, _, m, b)
            }
            return r._composite(l, s, d, p)
        },
        _composite: function(t, e, r, n) {
            return function(i, o) {
                for (var a = 0,
                l = 0; n > l && (a = t[l](i, o, e[l], r[l]), 0 == a); l++);
                return a
            }
        },
        _sortLocalData: function(t, e) {
            if (!e) return [];
            if (!e.length || !t || !t.length) return e;
            var r = this,
            n = r.that,
            i = n.options.sortModel,
            o = r.compileSorter(t),
            a = {
                sort_composite: o,
                data: e
            };
            return n._trigger("customSort", null, a) !== !1 ? e.sort(o) : e = a.data,
            i.useCache && setTimeout(r.removeCache(t, e), 0),
            e
        },
        useCache: function(t, e, r, i) {
            for (var o = n["get_" + e], a = t.length; a--;) {
                var l = t[a];
                l[i] = o(l[r])
            }
        },
        removeCache: function(t, e) {
            var r = this.tmpPrefix;
            return function() {
                for (var n = t.length; n--;) {
                    var i = t[n],
                    o = r + i.dataIndx,
                    a = e.length;
                    if (a && e[0].hasOwnProperty(o)) for (; a--;) delete e[a][o]
                }
            }
        },
        writeCancel: function(t) {
            this.that.options.sortModel.cancel = t
        },
        writeSingle: function(t) {
            this.that.options.sortModel.single = t
        },
        writeSorter: function(t) {
            var e = this.that.options,
            r = e.sortModel;
            r.sorter = t
        }
    };
    var n = {
        get_date: function(t) {
            var e;
            return t ? isNaN(e = Date.parse(t)) ? 0 : e: 0
        },
        sort_number: function(t, e, r, n) {
            var i = t[r],
            o = e[r];
            return i = i ? 1 * i: 0,
            o = o ? 1 * o: 0,
            (i - o) * n
        },
        sort_date: function(t, e, r, n) {
            var i = t[r],
            o = e[r];
            return i = i ? Date.parse(i) : 0,
            o = o ? Date.parse(o) : 0,
            (i - o) * n
        },
        sort_date_fast: function(t, e, r, n) {
            var i = t[r],
            o = e[r];
            return (i - o) * n
        },
        sort_dataType: function(t, e, r, n, i) {
            var o = t[r],
            a = e[r];
            return i(o, a) * n
        },
        sort_sortType: function(t, e, r, n, i) {
            return i(t, e, r) * n
        },
        sort_string: function(t, e, r, n) {
            var i = t[r] || "",
            o = e[r] || "",
            a = 0;
            return i > o ? a = 1 : o > i && (a = -1),
            a * n
        },
        sort_locale: function(t, e, r, n) {
            var i = t[r] || "",
            o = e[r] || "";
            return i.localeCompare(o) * n
        },
        sort_bool: function(t, e, r, n) {
            var i = t[r],
            o = e[r],
            a = 0;
            return i && !o || i === !1 && null === o ? a = 1 : (o && !i || o === !1 && null === i) && (a = -1),
            a * n
        }
    };
    pq.sortObj = n
} (jQuery),
function(t) {
    function e(t, e, r) {
        var n, i = 0,
        o = e,
        a = t.length;
        for (r = r > a ? a: r; r > o; o++) n = t[o],
        n.pq_hidden !== !0 && i++;
        return i
    }
    function r(t) {
        this.that = t,
        this.mc = null;
        var e = this;
        t.on("dataReady columnOrder groupShowHide",
        function(r, n) {
            t.options.mergeCells && "pager" !== n.source && e.init()
        })
    }
    var n = t.paramquery.pqGrid.prototype;
    n.calcVisibleRows = e,
    t.paramquery.cMerge = r,
    r.prototype = {
        calcVisibleColumns: function(t, e, r) {
            var n = 0,
            i = t.length;
            for (r = r > i ? i: r; r > e; e++) t[e].hidden !== !0 && n++;
            return n
        },
        findNextVisibleColumn: function(t, e, r) {
            for (var n, i = e; e + r > i; i++) {
                if (n = t[i], !n) return - 1;
                if (!n.hidden) return i
            }
        },
        findNextVisibleRow: function(t, e, r) {
            for (var n, i = e; e + r > i; i++) {
                if (n = t[i], !n) return - 1;
                if (!n.pq_hidden) return i
            }
        },
        getData: function(t, e, r) {
            var n, i = this.mc;
            if (i[t] && (n = i[t][e])) {
                var o = n.data;
                return o ? o[r] : null
            }
        },
        inflateRange: function(t, e, r, n) {
            var i = this.that,
            o = !1,
            a = i.options,
            l = a.groupModel,
            s = l.on ? i.riOffset + i.pdata.length - 1 : a.dataModel.data.length - 1,
            d = i.colModel.length - 1,
            c = this.mc2;
            if (!c) return [t, e, r, n];
            t: for (var u = 0,
            h = c.length; h > u; u++) {
                var f = c[u],
                p = f.r1,
                g = f.c1,
                v = p + f.rc - 1,
                m = g + f.cc - 1,
                v = v > s ? s: v,
                m = m > d ? d: m,
                w = t > p && v >= t,
                x = r >= p && v > r,
                y = e > g && m >= e,
                C = n >= g && m > n;
                if ((w || x) && m >= e && n >= g || (y || C) && v >= t && r >= p) {
                    o = !0,
                    t = t > p ? p: t,
                    e = e > g ? g: e,
                    r = v > r ? v: r,
                    n = m > n ? m: n;
                    break t
                }
            }
            return o ? this.inflateRange(t, e, r, n) : [t, e, r, n]
        },
        init: function() {
            for (var t = this.that,
            r = this.findNextVisibleColumn,
            n = this.findNextVisibleRow,
            i = this.calcVisibleColumns,
            o = t.colModel,
            a = t.options.mergeCells || [], l = t.get_p_data(), s = [], d = [], c = 0, u = a.length; u > c; c++) {
                var h, f, p = a[c],
                g = p.r1,
                v = g,
                m = l[g],
                w = p.c1,
                x = w,
                y = o[w],
                C = p.rc,
                _ = p.cc;
                if (y && m && (y.hidden && (x = r(o, w, _)), h = i(o, w, w + _), m.pq_hidden && (v = n(l, g, C)), f = e(l, g, g + C), !(1 > f || 1 > h))) {
                    s.push({
                        r1: g,
                        c1: w,
                        rc: C,
                        cc: _
                    }),
                    d[v] = d[v] || [],
                    d[v][x] = {
                        show: !0,
                        rowspan: f,
                        colspan: h,
                        o_rowspan: C,
                        o_colspan: _,
                        style: p.style,
                        cls: p.cls,
                        attr: p.attr,
                        r1: g,
                        c1: w,
                        v_r1: v,
                        v_c1: x
                    };
                    for (var I = {
                        show: !1,
                        r1: g,
                        c1: w,
                        v_r1: v,
                        v_c1: x
                    },
                    b = g; g + C > b; b++) {
                        d[b] = d[b] || [];
                        for (var q = w; w + _ > q; q++) b == v && q == x || (d[b][q] = I)
                    }
                }
            }
            t._mergeCells = d.length > 0,
            this.mc = d,
            this.mc2 = s
        },
        ismergedCell: function(t, e) {
            var r, n = this.mc;
            if (n && n[t] && (r = n[t][e])) {
                var i = r.v_r1,
                o = r.v_c1;
                return t == i && e == o ? {
                    o_ri: r.r1,
                    o_ci: r.c1,
                    v_rc: r.rowspan,
                    v_cc: r.colspan,
                    o_rc: r.o_rowspan,
                    o_cc: r.o_colspan
                }: !0
            }
            return ! 1
        },
        isRootCell: function(t, e, r) {
            var n, i = this.mc;
            if (i && i[t] && (n = i[t][e])) {
                if ("o" == r) return t == n.r1 && e == n.c1;
                var o = n.v_r1,
                a = n.v_c1;
                if (o == t && a == e) {
                    var l = i[o][a];
                    return {
                        rowspan: l.rowspan,
                        colspan: l.colspan
                    }
                }
            }
        },
        removeData: function(t, e, r) {
            var n, i = (this.that, this.mc);
            if (i && i[t] && (n = i[t][e])) {
                var o = n.data;
                o && (o[r] = null)
            }
        },
        getRootCell: function(t, e) {
            var r, n, i, o = this.mc;
            return o && o[t] && (i = o[t][e]) ? (r = i.v_r1, n = i.v_c1, i = o[r][n], {
                o_ri: i.r1,
                o_ci: i.c1,
                v_ri: r,
                v_ci: n,
                v_rc: i.rowspan,
                v_cc: i.colspan,
                o_rc: i.o_rowspan,
                o_cc: i.o_colspan
            }) : void 0
        },
        getRootCellO: function(t, e, r, n) {
            n = n || "o";
            var i, o = "o" == n,
            a = this.getRootCell(t, e);
            return a ? (i = {
                rowIndx: a[o ? "o_ri": "v_ri"],
                colIndx: a[o ? "o_ci": "v_ci"]
            },
            this.that.normalize(i)) : (r && (i = {
                rowIndx: t,
                colIndx: e
            }), i ? this.that.normalize(i) : null)
        },
        getRootCellV: function(t, e, r) {
            return this.getRootCellO(t, e, r, "v")
        },
        getClsStyle: function(t, e) {
            return this.mc[t][e]
        },
        getMergeCells: function(t, e, r) {
            for (var n, i, o, a = this.that,
            l = a.options.mergeCells,
            s = a.riOffset,
            d = s + r,
            c = [], u = l ? l.length: 0, h = 0; u > h; h++) n = l[h],
            i = n.r1,
            o = n.c1,
            (!e || i >= s && d > i) && (e && (i -= s), i += t, c.push({
                r1: i,
                c1: o,
                r2: i + n.rc - 1,
                c2: o + n.cc - 1
            }));
            return c
        },
        setData: function(t, e, r) {
            var n, i = this.mc;
            i[t] && (n = i[t][e]) && (n.data = r)
        }
    }
} (jQuery),
function(t) {
    function e(t, e, r, n) {
        t.push("<li data-option='", r, "' class='pq-menu-item'>", "<label>", "<input type='checkbox' ", e[r] ? "checked": "", "/>", n["strGroup_" + r], "</label></li>")
    }
    function r(t, e, r, n) {
        var i, o = t[e],
        a = n;
        if (o) {
            do i = o[a].rip,
            a++;
            while (r > i);
            return a - 1
        }
    }
    var n = t.paramquery;
    n.pqGrid.defaults.groupModel = {
        on: !1,
        title: [],
        titleDefault: "{0} ({1})",
        header: !0,
        headerMenu: !0,
        menuItems: ["merge", "fixCols", "grandSummary"],
        fixCols: !0,
        icon: ["ui-icon-triangle-1-se", "ui-icon-triangle-1-e"],
        dataIndx: [],
        collapsed: [],
        showSummary: [],
        calcSummary: [],
        summaryInTitleRow: "collapsed",
        summaryEdit: !0,
        refreshOnChange: !0
    },
    pq.aggregate = {
        sum: function(t) {
            for (var e, r = 0,
            n = t.length; n--;) e = t[n],
            null != e && (r += e - 0);
            return r
        },
        avg: function(t, e) {
            try {
                var r = pq.formulas.AVERAGE(t)
            } catch(n) {
                r = n
            }
            return r
        },
        flatten: function(t) {
            return t.filter(function(t) {
                return null != t
            })
        },
        max: function(t, e) {
            var r, n = e.dataType;
            return t = this.flatten(t),
            "float" == n || "integer" == n ? r = Math.max.apply(Math, t) : "date" == n ? (t.sort(function(t, e) {
                return t = Date.parse(t),
                e = Date.parse(e),
                e - t
            }), r = t[0]) : (t.sort(), r = t[t.length - 1]),
            r
        },
        min: function(t, e) {
            var r, n, i, o, a = e.dataType;
            if (t = this.flatten(t), "integer" == a || "float" == a) r = Math.min.apply(Math, t);
            else if ("date" == a) {
                for (o = t.length, n = []; o--;) i = t[o],
                n.push({
                    dateO: i,
                    dateP: Date.parse(i)
                });
                n.sort(function(t, e) {
                    return t.dateP - e.dateP
                }),
                r = n.length ? n[0].dateO: void 0
            } else t.sort(),
            r = t[0];
            return r
        },
        count: function(t) {
            return this.flatten(t).length
        },
        stdev: function(t) {
            try {
                var e = pq.formulas.STDEV(t)
            } catch(r) {
                e = r
            }
            return e
        },
        stdevp: function(t) {
            try {
                var e = pq.formulas.STDEVP(t)
            } catch(r) {
                e = r
            }
            return e
        }
    };
    var i = n.cGroup = function(t) {
        var e = this;
        e.that = t,
        t.options.groupModel.on && e.init()
    };
    i.beforeTrigger = function(t, e) {
        return function(r) {
            return e._trigger("beforeGroupExpand", t, r) === !1
        }
    },
    i.onGroupItemClick = function(e) {
        return function(r) {
            var n = t(r.target),
            i = t(this).data("indx");
            n.hasClass("pq-group-remove") ? e.removeGroup(i) : e.toggleLevel(i, r)
        }
    },
    i.prototype = {
        addGroup: function(e, r) {
            var n = this.that,
            i = n.options.groupModel,
            o = i.dataIndx = i.dataIndx || [];
            null != e && -1 === t.inArray(e, o) && (null == r ? o.push(e) : o.splice(r, 0, e), this._triggerChange = !0, this.refreshFull())
        },
        createHeader: function() {
            for (var e = this,
            r = e.that,
            n = e.$header,
            o = r.options,
            a = o.bootstrap,
            l = r.columns,
            s = a.on,
            d = o.groupModel,
            c = d.dataIndx,
            u = c.length; u--;) null == l[c[u]] && c.splice(u, 1);
            if (u = c.length, d.header && d.on) {
                if (n ? n.empty() : (n = e.$header = t("<div class='pq-group-header ui-helper-clearfix' ></div>").appendTo(r.$top), n.on("click", ".pq-group-item", i.onGroupItemClick(e))), u) {
                    for (var h = [], f = 0; u > f; f++) {
                        var p = c[f],
                        g = l[p],
                        v = d.collapsed,
                        m = s ? a.groupModel.icon: d.icon,
                        w = v[f] ? m[1] : m[0];
                        h.push("<div tabindex='0' class='pq-group-item' data-indx='", p, "' >", "<span class='", e.toggleIcon, w, "' ></span>", g.pqtitle || ("string" == typeof g.title ? g.title: p), "<span class='", e.groupRemoveIcon, "' ></span></div>")
                    }
                    n[0].innerHTML = h.join("")
                }
                e.initHeader(o, d)
            } else n && (n.remove(), e.$header = null)
        },
        concat: function() {
            return function(t, e, r) {
                return e.forEach(function(e) {
                    t.push(e)
                }),
                r.pq_children = e,
                t
            }
        },
        collapseTo: function(t) {
            this.expandTo(t, !0)
        },
        editorSummary: function(e, r) {
            var n = e.summaryOptions,
            i = this;
            return function(e) {
                var o = e.rowData;
                if (o.pq_gsummary || o.pq_gtitle) {
                    var a, l, s = pq.aggregate,
                    d = e.column,
                    c = d.summary,
                    u = c ? c.edit: null,
                    h = d.dataType,
                    f = [""];
                    if (t.inArray(e.dataIndx, r.dataIndx) > -1) return ! 1;
                    if (!r.summaryEdit && !u || u === !1) return ! 1;
                    "integer" == h || "float" == h ? h = "number": "date" !== h && (h = "string"),
                    l = n[h].split(","),
                    a = t.inArray;
                    for (var p in s) a(p, l) > -1 && f.push(p);
                    return 1 == f.length ? !1 : {
                        type: "select",
                        prepend: r.prepend,
                        options: r.options || f,
                        valueIndx: r.valueIndx,
                        labelIndx: r.labelIndx,
                        init: r.init || i.editorInit,
                        getData: r.getData || i.editorGetData
                    }
                }
            }
        },
        editorInit: function(t) {
            var e, r = t.column.summary;
            r || (r = t.column.summary = {}),
            e = r.type,
            t.$cell.find("select").val(e)
        },
        editorGetData: function(t) {
            var e = t.column,
            r = e.dataType,
            n = t.$cell.find("select").val();
            return e.summary.type = n,
            this.one("beforeValidate",
            function(t, n) {
                n.allowInvalid = !0,
                n.track = !1,
                n.history = !1,
                e.dataType = "string",
                this.one(!0, "change",
                function(t, n) {
                    e.dataType = r
                })
            }),
            n
        },
        expandTo: function(t, e) {
            var n, i, o, a, l, s = this.that,
            d = !!e,
            c = t.split(","),
            u = c.length,
            h = this.tree,
            f = 0,
            p = s.pdata;
            if (! (u > h.length)) {
                for (var g = 0; u > g; g++) {
                    if (l = 1 * c[g] + f, a = h[g][l], !a) {
                        if (0 == g) return;
                        break
                    }
                    n = a.rip,
                    (!d || d && g == u - 1) && (i = p[n], i.pq_close != d && (o = i, i.pq_close = d)),
                    f = r(h, g + 1, n, l)
                }
                o && s._trigger("group", null, {
                    indx: l,
                    close: d
                }) !== !1 && this.saveState(!0)
            }
        },
        collapseAll: function(t) {
            this.expandAll(t, !0)
        },
        expandAll: function(t, e) {
            this.trigger({
                all: !0,
                close: !!e,
                level: t || 0
            }) !== !1 && this.that.refreshView()
        },
        collapse: function(t) {
            this.expand(t, !0)
        },
        expand: function(t, e) {
            this.trigger({
                close: !!e,
                level: t || 0
            }) !== !1 && this.that.refreshView()
        },
        firstCol: function() {
            return this.that.colModel.find(function(t) {
                return ! t.hidden
            })
        },
        flatten: function(t, e, r, n) {
            var i = r.dataIndx,
            o = r.titleInFirstCol,
            a = o ? this.firstCol().dataIndx: null,
            l = this.concat(),
            s = this.tree = [],
            d = i.length,
            c = [];
            return function u(h, f, p) {
                if (!d) return h;
                var g = f || 0,
                v = i[g],
                m = r.collapsed[g],
                w = r.calcSummary[g] !== !1,
                x = r.showSummary[g],
                y = s[g] = s[g] || [],
                C = e(h, v, t[v]);
                return C.forEach(function(t) {
                    var e, r = t[1],
                    i = x ? {
                        pq_gsummary: !0,
                        pq_level: g,
                        pq_rowcls: "pq-summary-row"
                    }: 0,
                    s = r.length,
                    h = c.length;
                    e = {
                        pq_gtitle: !0,
                        pq_level: g,
                        pq_close: m,
                        pq_items: s,
                        pq_children: []
                    },
                    e[o ? a: v] = t[0],
                    c.push(e),
                    p && p.push(e),
                    w && n(r, e, i),
                    d > g + 1 ? u(r, g + 1, e.pq_children) : c = l(c, r, e),
                    i && c.push(i),
                    y.push({
                        rip: h,
                        rip2: c.length
                    })
                }),
                c
            }
        },
        getVal: function(e) {
            var r = t.trim;
            return function(t, n, i) {
                var o = t[n],
                a = i.groupChange;
                return a ? (a = pq.getFn(a))(o) : (o = r(o), e ? o.toUpperCase() : o)
            }
        },
        getSumCols: function() {
            return this._sumCols
        },
        getSumDIs: function() {
            return this._sumDIs
        },
        group: function(t) {
            return function(e, r, n) {
                var i = {},
                o = [];
                return e.forEach(function(e) {
                    e.pq_hidden = void 0;
                    var a = t(e, r, n),
                    l = i[a];
                    null == l && (i[a] = l = o.length, o[l] = [a, []]),
                    o[l][1].push(e)
                }),
                o
            }
        },
        groupData: function() {
            var t = this,
            e = t.that,
            r = e.options,
            n = r.groupModel,
            i = t.getVal(n.ignoreCase),
            o = n.dataIndx,
            a = e.pdata,
            l = e.columns,
            s = this.setSumCols(o),
            d = this.summary(s[0], s[1]);
            if (n.grandSummary) {
                var c = {
                    pq_grandsummary: !0,
                    pq_gsummary: !0
                };
                d(a, c),
                t.summaryData = r.summaryData = [c]
            } else t.summaryData.length = 0;
            e.pdata = this.flatten(l, this.group(i), n, d)(a)
        },
        init: function() {
            var t, e, r, n, i, o, a = this;
            a._init || (a.mc = [], a.tree = [], a.summaryData = [], o = a.that, t = o.options, e = t.groupModel, r = t.bootstrap, n = r.on, i = n ? "glyphicon ": "ui-icon ", a.groupRemoveIcon = "pq-group-remove " + i + (n ? "glyphicon-remove": "ui-icon-close"), a.toggleIcon = "pq-group-toggle " + i, o.on("cellClick", a.onCellClick(a)).on("cellKeyDown", a.onCellKeyDown(a, e)).on(!0, "cellMouseDown", a.onCellMouseDown()).on("change", a.onChange(a, e)).on("dataReady", a.onDataReady(a, o)).on("columnDragDone", a.onColumnDrag(a)).on("columnOrder", a.onColumnOrder(a, e)), a._init = !0)
        },
        initHeadSortable: function() {
            var t = this,
            e = t.that,
            r = t.$header,
            n = e.options;
            r.sortable({
                axis: "x",
                distance: 3,
                tolerance: "pointer",
                cancel: ".pq-group-menu",
                stop: t.onSortable(t, n)
            })
        },
        initHeadDroppable: function() {
            var t = this,
            e = t.that,
            r = t.$header;
            r && (r.droppable({
                accept: function(r) {
                    var n = 1 * r.attr("pq-col-indx");
                    if (!isNaN(n) && e.colModel[n]) return t.acceptDrop
                },
                tolerance: "pointer",
                hoverClass: "pq-drop-hover",
                drop: t.onDrop(e, t)
            }), t.acceptDrop = !0)
        },
        initHeader: function(t, e) {
            var r = this;
            if (r.$header) {
                var n = r.$header,
                i = n.find(".pq-group-item");
                n.data("uiSortable") || r.initHeadSortable(),
                i.length || n.append("<span class='pq-group-placeholder'>" + t.strGroup_header + "</span>"),
                e.headerMenu && r.initHeaderMenu()
            }
        },
        initHeaderMenu: function() {
            for (var r, n = this,
            i = n.that,
            o = i.BS_on,
            a = i.options,
            l = n.$header,
            s = ["<ul class='pq-group-menu'><li>", o ? "<span class='glyphicon glyphicon-chevron-left'></span>": "", "<ul>"], d = a.groupModel, c = d.menuItems, u = 0, h = c.length; h > u; u++) e(s, d, c[u], a);
            s.push("</ul></li></ul>"),
            r = t(s.join("")).appendTo(l),
            r.menu({
                icons: {
                    submenu: "ui-icon-carat-1-w"
                },
                position: {
                    my: "right top",
                    at: "left top"
                }
            }),
            r.change(function(e) {
                if ("INPUT" == e.target.nodeName) {
                    var r = t(e.target),
                    i = r.closest("li").data("option"),
                    o = {};
                    o[i] = !a.groupModel[i],
                    n.option(o)
                }
            })
        },
        initmerge: function() {
            for (var t, e, r, n, i, o, a, l, s = this.that,
            d = s.options,
            c = d.groupModel,
            u = c.dataIndx,
            h = s.colIndxs,
            f = c.merge,
            p = c.summaryInTitleRow,
            g = c.titleInFirstCol,
            v = this.tree,
            m = s.riOffset,
            w = s.colModel.length,
            x = [], y = s.pdata, C = 0; C < v.length; C++) {
                t = v[C],
                r = h[u[C]];
                for (var _ = 0,
                I = t.length; I > _ && (e = t[_], n = e.rip, null != n); _++) f ? (i = e.rip2, o = i - n, a = n + m, x.push({
                    r1: a,
                    rc: o,
                    c1: r,
                    cc: 1
                })) : (a = n + m, l = y[n], p && (l.pq_close || "collapsed" !== p) || x.push({
                    r1: a,
                    rc: 1,
                    c1: g ? 0 : r,
                    cc: w
                }))
            }
            x.length ? (this.mc = d.mergeCells = x, s.iMerge.init()) : this.mc.length && (this.mc.length = 0, s.iMerge.init())
        },
        initcollapsed: function() {
            var t, e, r, n, i, o, a = this.that,
            l = a.options.groupModel,
            s = l.merge,
            d = this.pdata,
            c = a.pdata;
            if (c) {
                for (var u = 0,
                h = c.length; h > u; u++) t = c[u],
                e = t.pq_gtitle,
                void 0 !== e && (i = t.pq_level, o = null, d && (r = d[u], n = r ? r.pq_close: null, null != n && (o = t.pq_close = n)), null == o && (o = t.pq_close), o ? this.showHideRows(u + 1, i, l) : s && (t.pq_hidden = !0));
                delete this.pdata
            }
        },
        onCellClick: function(e) {
            return function(r, n) {
                n.rowData.pq_gtitle && t(r.originalEvent.target).hasClass("pq-group-icon") && e.toggleRow(n.rowIndxPage, r)
            }
        },
        onCellMouseDown: function() {
            return function(e, r) {
                r.rowData.pq_gtitle && t(e.originalEvent.target).hasClass("pq-group-icon") && e.stopImmediatePropagation()
            }
        },
        onCellKeyDown: function(e, r) {
            return function(n, i) {
                return i.rowData.pq_gtitle && t.inArray(i.dataIndx, r.dataIndx) >= 0 && n.keyCode == t.ui.keyCode.ENTER ? (e.toggleRow(i.rowIndxPage, n), !1) : void 0
            }
        },
        onChange: function(t, e) {
            return function() {
                t.saveState(e.refreshOnChange)
            }
        },
        onColumnDrag: function(t) {
            return function(e, r) {
                var n = r.column,
                i = n.colModel;
                i && i.length || n.groupable === !1 ? t.acceptDrop = !1 : t.initHeadDroppable()
            }
        },
        onDrop: function(t, e) {
            return function(r, n) {
                var i = 1 * n.draggable.attr("pq-col-indx"),
                o = t.colModel[i].dataIndx;
                e.addGroup(o),
                e.acceptDrop = !1
            }
        },
        onSortable: function(e, r) {
            return function() {
                for (var n, i, o, a = [], l = r.groupModel, s = l.dataIndx, d = t(this).find(".pq-group-item"), c = 0; c < d.length; c++) i = t(d[c]),
                o = i.data("indx"),
                s[c] !== o && (n = !0),
                a.push(o);
                n && (l.dataIndx = a, e._triggerChange = !0, e.refreshFull())
            }
        },
        onDataReady: function(t, e) {
            return function() {
                t.tree.length = 0;
                var r = e.options.groupModel,
                n = r.dataIndx.length;
                r.on && (n || r.grandSummary) && (t.groupData(), t.refreshColumns(), n && (t.initcollapsed(), t.initmerge())),
                t.createHeader()
            }
        },
        onColumnOrder: function(t, e) {
            return function() {
                return e.titleInFirstCol ? (t.refreshFull(), !1) : void t.initmerge()
            }
        },
        option: function(e, r) {
            var n = e.dataIndx,
            i = this.that,
            o = n ? n.length: 0,
            a = this,
            l = i.options,
            s = l.groupModel,
            d = s.dataIndx,
            c = e.on || null == e.on && s.on;
            c && a.init(),
            s.on && d.length && (e.on === !1 || 0 === o) && a.showRows(),
            t.extend(s, e),
            a.setOption(),
            r !== !1 && i.refreshView()
        },
        showRows: function() {
            this.that.options.dataModel.data.forEach(function(t) {
                t.pq_hidden && (t.pq_hidden = void 0)
            })
        },
        renderCell: function(t, e) {
            var r = this.renderTitle(t, e),
            n = this.renderSummary(t);
            return function(t, e) {
                t._render = t._renderG = function(t) {
                    var i = t.rowData,
                    o = i.pq_gtitle;
                    return e && o ? r(t) : o || i.pq_gsummary ? n(t) : void 0
                }
            }
        },
        renderSummary: function(t) {
            var e = this.that;
            return function(r) {
                var n, i, o, a = (r.rowData, r.column),
                l = a.summary;
                return l && (i = l.type) ? (o = t.summaryTitle[i], "function" == typeof o ? o.call(e, r) : (n = r.formatVal, null == n && (n = r.cellData, n = null == n ? "": n), "number" != typeof n || a.format || parseInt(n) === n || (n = n.toFixed(2)), o ? o.replace("{0}", n) : n)) : void 0
            }
        },
        renderTitle: function(t, e) {
            var r = this.that,
            n = t.bootstrap,
            i = e.indent || 0,
            o = n.on,
            a = o ? n.groupModel.icon: e.icon,
            l = o ? ["glyphicon " + a[0], "glyphicon " + a[1]] : ["ui-icon " + a[0], "ui-icon " + a[1]];
            return function(t) {
                var n, o, a, s, d = t.rowData;
                return null != t.cellData ? (n = d.pq_close, o = d.pq_level, a = e.title, a = a[o] || e.titleDefault, a = "function" == typeof a ? a.call(r, t) : a.replace("{0}", t.cellData).replace("{1}", d.pq_items), s = n ? 1 : 0, {
                    text: (t.Export ? "": "<span style='margin-left:" + i * o + "px;' class='pq-group-icon " + l[s] + "'></span>") + a,
                    cls: "pq-group-title-cell",
                    style: "text-align:left;"
                }) : void 0
            }
        },
        removeGroup: function(t) {
            for (var e = this,
            r = e.that,
            n = 0,
            i = r.options.groupModel,
            o = i.dataIndx; n < o.length; n++) if (t === o[n]) {
                o.splice(n, 1);
                break
            }
            o.length || (e.showRows(), e.mc.length = 0),
            e._triggerChange = !0,
            e.refreshFull()
        },
        refreshColumns: function() {
            for (var t, e, r, n = this.that,
            i = n.options,
            o = i.groupModel,
            a = o.on,
            l = o.fixCols,
            s = this.renderCell(i, o), d = o.dataIndx, c = d.length, u = n.colModel, h = u.length; h--;) t = u[h],
            t._renderG && (delete t._render, delete t._renderG),
            t._nodrag && (delete t._nodrag, delete t._nodrop),
            a && (e = t.summary) && e.type && s(t);
            if (i.geditor = a ? this.editorSummary(i, o) : void 0, a) if (o.titleInFirstCol) t = this.firstCol(),
            s(t, !0);
            else for (h = c - 1; h >= 0; h--) t = n.getColumn({
                dataIndx: d[h]
            }),
            s(t, !0);
            if (l && a) for (h = 0; c > h; h++) r = n.getColIndx({
                dataIndx: d[h]
            }),
            t = u[r],
            t._nodrag = t._nodrop = !0,
            r != h && (n.iDragColumns.moveColumn(r, h, !0), n.iColModel.init())
        },
        refreshFull: function() {
            var t = this.that;
            this._triggerChange && (t._trigger("groupChange"), this._triggerChange = !1),
            t.refreshView()
        },
        refreshView: function() {
            this.that.refreshView()
        },
        showHideRows: function(t, e, r) {
            for (var n, i = this.that,
            o = !0,
            a = i.pdata,
            l = t,
            s = a.length; s > l; l++) if (n = a[l], n.pq_gsummary) r.merge || r.summaryInTitleRow ? n.pq_level >= e && (n.pq_hidden = o) : n.pq_level > e && (n.pq_hidden = o);
            else if (n.pq_gtitle) {
                if (n.pq_level <= e) break;
                n.pq_hidden = o
            } else n.pq_hidden = o
        },
        saveState: function(t) {
            var e = this.that,
            r = e.options.groupModel;
            if (r.on && r.dataIndx.length) {
                for (var n = e.pdata,
                i = n.length,
                o = new Array(i), a = 0; i > a; a++) o[a] = n[a];
                this.pdata = o,
                t && e.refreshView()
            }
        },
        setSumCols: function(e) {
            var r = t.inArray,
            n = [],
            i = [];
            return this.that.colModel.forEach(function(t) {
                var o, a = t.summary;
                a && a.type && (o = t.dataIndx, -1 === r(o, e) && (n.push(t), i.push(o)))
            }),
            this._sumCols = n,
            this._sumDIs = i,
            [n, i]
        },
        summary: function(t, e) {
            var r = pq.aggregate,
            n = t.map(function(t) {
                return t.summary.type
            });
            return function(i, o, a) {
                e.forEach(function(e, l) {
                    var s, d = [];
                    i.forEach(function(t, r) {
                        d[r] = t[e]
                    }),
                    s = r[n[l]](d, t[l]),
                    null == o[e] && (o[e] = s),
                    a && (a[e] = s)
                })
            }
        },
        setOption: function() {
            var t = this;
            t._init && (t.refreshColumns(), t.summaryData.length = 0, t.tree.length = 0, t.initmerge())
        },
        toggleLevel: function(e, r) {
            var n = this.that.options.groupModel,
            i = n.collapsed,
            o = t.inArray(e, n.dataIndx),
            a = r.ctrlKey ? "All": "",
            l = i[o];
            this[(l ? "expand": "collapse") + a](o)
        },
        trigger: function(t) {
            var e, r, n, o, a = t.evt,
            l = t.rd,
            s = t.level,
            d = t.all,
            c = t.close,
            u = this.that,
            h = u.options.groupModel,
            f = h.dataIndx,
            p = h.collapsed,
            g = i.beforeTrigger(a, u),
            v = {};
            if (l) {
                if (e = l.pq_level, r = f[e], n = l[r], c = !l.pq_close, v = {
                    level: e,
                    close: c,
                    group: n
                },
                g(v)) return ! 1;
                l.pq_close = c
            } else if (d) {
                if (v = {
                    all: !0,
                    close: c,
                    level: s
                },
                g(v)) return ! 1;
                for (o = s; o < f.length; o++) p[o] = c
            } else if (null != s) {
                if (v = {
                    level: s,
                    close: c
                },
                g(v)) return ! 1;
                p[s] = c
            }
            return u._trigger("group", null, v)
        },
        toggleRow: function(t, e) {
            var r = this.that,
            n = r.pdata,
            i = n[t];
            this.trigger({
                evt: e,
                rd: i
            }) !== !1 && this.saveState(!0)
        }
    };
    var o = n.pqGrid.prototype;
    o.Group = function(t) {
        var e = this.iGroup;
        return null == t ? e: void e.expandTo(t.indx)
    }
} (jQuery),
function(t) {
    var e = t.paramquery;
    t(document).on("pqGrid:bootup",
    function(t, e) {
        var n = e.instance;
        n.iFillHandle = new r(n)
    }),
    e.pqGrid.defaults.fillHandle = "all",
    e.pqGrid.defaults.autofill = !0;
    var r = e.cFillHandle = function(t) {
        var e = this;
        e.$wrap,
        e.locked,
        e.sel,
        e.that = t,
        t.on("selectChange", e.onSelectChange(e)).on("selectEnd", e.onSelectEnd(e)).on("assignTblDims", e.onRefresh(e))
    };
    r.prototype = {
        create: function() {
            var e = this;
            if (!e.locked) {
                e.remove();
                var r = e.that,
                n = r.Selection().address();
                if (1 === n.length) {
                    var n = n[0],
                    i = n.r2,
                    o = n.c2,
                    a = r.iMerge,
                    l = a.getRootCellO(i, o, !0),
                    s = r.getCell(l);
                    if (s.length && r._trigger("beforeFillHandle", null, l) !== !1) {
                        var d = s[0],
                        c = d.parentNode.parentNode,
                        u = c.parentNode,
                        h = 10,
                        f = d.offsetLeft + d.offsetWidth - 5,
                        p = d.parentNode.offsetTop + d.offsetHeight - 5,
                        g = Math.min(f + h, c.offsetWidth),
                        f = g - h,
                        v = Math.min(p + h, c.offsetHeight),
                        p = v - h,
                        m = t("<div class='pq-fill-handle'></div>").appendTo(u);
                        m.css({
                            position: "absolute",
                            top: p,
                            left: f,
                            height: h,
                            width: h,
                            background: "#333",
                            cursor: "crosshair",
                            border: "2px solid #fff",
                            zIndex: 1
                        }),
                        e.$wrap = m
                    }
                }
            }
        },
        onSelectChange: function(t) {
            return function() {
                t.remove()
            }
        },
        onSelectEnd: function(t) {
            return function() {
                this.options.fillHandle && (t.create(), t.setDraggable(), t.setDoubleClickable())
            }
        },
        onRefresh: function(t) {
            var e;
            return function() {
                this.options.fillHandle ? (clearTimeout(e), e = setTimeout(function() {
                    t.that.element && (t.create(), t.setDraggable())
                },
                50)) : t.remove()
            }
        },
        remove: function() {
            var t = this.$wrap;
            t && t.remove()
        },
        setDoubleClickable: function() {
            var t = this,
            e = t.$wrap;
            e && e.on("dblclick", t.onDblClick(t.that, t))
        },
        setDraggable: function() {
            var t = this,
            e = t.$wrap,
            r = t.that.$cont;
            e && e.draggable({
                helper: function() {
                    return "<div style='height:10px;width:10px;cursor:crosshair;'></div>"
                },
                appendTo: r,
                start: function() {
                    t.onStart()
                },
                drag: function(e) {
                    t.onDrag(e)
                },
                stop: function() {
                    t.onStop()
                }
            })
        },
        patternDate: function(t) {
            var e = this;
            return function(r) {
                var n = new Date(t);
                return n.setDate(n.getDate() + (r - 1)),
                e.formatDate(n)
            }
        },
        formatDate: function(t) {
            return t.getMonth() + 1 + "/" + t.getDate() + "/" + t.getFullYear()
        },
        patternDate2: function(t, e) {
            var r, n = new Date(t),
            i = new Date(e),
            o = this,
            a = i.getDate() - n.getDate(),
            l = i.getMonth() - n.getMonth(),
            s = i.getFullYear() - n.getFullYear();
            return ! l && !s || !a && !l || !s && !a ?
            function(e) {
                var r = new Date(t);
                return a ? r.setDate(r.getDate() + a * (e - 1)) : l ? r.setMonth(r.getMonth() + l * (e - 1)) : r.setFullYear(r.getFullYear() + s * (e - 1)),
                o.formatDate(r)
            }: (n = Date.parse(n), r = Date.parse(i) - n,
            function(t) {
                var e = new Date(n + r * (t - 1));
                return o.formatDate(e)
            })
        },
        pattern: function(t, e) {
            if ("date" == e || "integer" == e || "float" == e) {
                var r, n, i, o = t.length,
                a = "date" === e;
                return 1 === o ? (r = t[0], a ? this.patternDate(r) : function(t) {
                    return r + (t - 1)
                }) : 2 === o ? a ? this.patternDate2(t[0], t[1]) : (r = t[1] - t[0], n = t[0] - r,
                function(t) {
                    return r * t + n
                }) : 3 === o ? (r = (t[2] - 2 * t[1] + t[0]) / 2, n = t[1] - t[0] - 3 * r, i = t[0] - r - n,
                function(t) {
                    return r * t * t + n * t + i
                }) : !1
            }
        },
        autofillVal: function(t, e, r, n) {
            var i, o, a, l, s, d = this.that,
            c = t.r1,
            u = t.c1,
            h = t.r2,
            f = t.c2,
            p = e.r1,
            g = e.c1,
            v = e.r2,
            m = e.c2,
            w = [];
            if (n) {
                for (l = {
                    r1: c,
                    r2: h
                },
                l.c1 = u > g ? g: f + 1, l.c2 = u > g ? u - 1 : m, s = g - u, o = g; m >= o; o++) if (s++, u > o || o > f) for (i = 0, a = c; h >= a; a++) w.push(r[i](s, o)),
                i++
            } else for (l = {
                c1: u,
                c2: f
            },
            l.r1 = c > p ? p: h + 1, l.r2 = c > p ? c - 1 : v, s = p - c, o = p; v >= o; o++) if (s++, c > o || o > h) for (i = 0, a = u; f >= a; a++) w.push(r[i](s, o)),
            i++;
            return d.Range(l).value(w),
            !0
        },
        autofill: function(t, e) {
            var r, n, i, o, a, l, s, d, c = this.that,
            u = c.colModel,
            h = c.get_p_data(),
            f = [],
            p = t.r1,
            g = t.c1,
            v = t.r2,
            m = t.c2,
            w = e.c1 != g || e.c2 != m;
            if (w) {
                for (a = p; v >= a; a++) {
                    if (s = {
                        sel: {
                            r: a,
                            c: g
                        },
                        x: !0
                    },
                    c._trigger("autofillSeries", null, s), !(d = s.series)) return;
                    f.push(d)
                }
                return this.autofillVal(t, e, f, w)
            }
            for (l = g; m >= l; l++) {
                for (r = u[l], n = r.dataType, o = r.dataIndx, i = [], a = p; v >= a; a++) i.push(h[a][o]);
                if (s = {
                    cells: i,
                    sel: {
                        r1: p,
                        c: l,
                        r2: v,
                        r: p
                    }
                },
                c._trigger("autofillSeries", null, s), !(d = s.series || this.pattern(i, n))) return;
                f.push(d)
            }
            return this.autofillVal(t, e, f)
        },
        onStop: function() {
            var t = this,
            e = t.that,
            r = e.options.autofill,
            n = t.sel,
            i = e.Selection().address()[0];
            n.r1 == i.r1 && n.c1 == i.c1 && n.r2 == i.r2 && n.c2 == i.c2 || (t.locked = !1, r && t.autofill(n, i) || e.Range(n).copy({
                dest: i
            }))
        },
        onStart: function() {
            this.locked = !0,
            this.sel = this.that.Selection().address()[0]
        },
        onDrag: function(e) {
            var r = this,
            n = r.that,
            i = n.options.fillHandle,
            o = "all" == i,
            a = o || "horizontal" == i,
            l = o || "vertical" == i,
            s = e.clientX - 10,
            d = e.clientY,
            c = document.elementFromPoint(s, d),
            u = t(c).closest(".pq-grid-cell");
            if (u.length) {
                var h = n.getCellIndices({
                    $td: u
                }),
                f = r.sel,
                p = f.r1,
                g = f.c1,
                v = f.r2,
                m = f.c2,
                w = {
                    r1: p,
                    c1: g,
                    r2: v,
                    c2: m
                },
                x = function(t, e) {
                    w[t] = e,
                    n.Range(w).select()
                },
                y = h.rowIndx,
                C = h.colIndx;
                o && v >= y && y >= p || a && !l ? C > m ? x("c2", C) : g > C && x("c1", C) : l && (y > v ? x("r2", y) : p > y && x("r1", y))
            }
        },
        onDblClick: function(t, e) {
            return function() {
                var r = t.options,
                n = r.fillHandle;
                if ("all" == n || "vertical" == n) {
                    for (var i, o = t.Selection().address()[0], a = o.c2, l = o.r2 + 1, s = r.dataModel.data, d = t.getColModel()[a].dataIndx; i = s[l];) {
                        if (null != i[d] && "" !== i[d]) {
                            l--;
                            break
                        }
                        l++
                    }
                    e.onStart(),
                    t.Range({
                        r1: o.r1,
                        c1: o.c1,
                        r2: l,
                        c2: a
                    }).select(),
                    e.onStop()
                }
            }
        }
    }
} (jQuery),
function(t) {
    t(document).on("pqGrid:bootup",
    function(t, r) {
        new e(r.instance)
    });
    var e = t.paramquery.cScroll = function(e) {
        var r = this,
        n = t(document),
        i = ".pqgrid-csroll";
        r.that = e,
        e.on("create", r.oneRefresh(e, r, n, i))
    };
    e.prototype = {
        oneRefresh: function(e, r, n, i) {
            return function() {
                e.$cont.on("mousedown",
                function(e) {
                    var o = t(e.target); (o.closest(".pq-grid-cell").length || o.closest(".pq-fill-handle").length) && n.on("mousemove" + i,
                    function(t) {
                        r.onMouseDrag(t)
                    }).on("mouseup" + i,
                    function() {
                        n.off(i)
                    })
                })
            }
        },
        onMouseDrag: function(t) {
            var e = this,
            r = e.that,
            n = r.$cont,
            i = n[0].offsetHeight,
            o = n[0].offsetWidth,
            a = n.offset(),
            l = a.top,
            s = a.left,
            d = l + i,
            c = s + o,
            u = t.pageY,
            h = t.pageX,
            f = u - d,
            p = h - c,
            g = l - u,
            v = s - h;
            h > s && c > h && (f > 0 || g > 0) ? f > 0 ? e.scrollV(f, !0) : g > 0 && e.scrollV(g) : u > l && d > u && (p > 0 ? e.scrollH(p, !0) : v > 0 && e.scrollH(v))
        },
        scrollH: function(t, e) {
            this.scroll(t, e, !0)
        },
        scrollV: function(t, e) {
            this.scroll(t, e)
        },
        scroll: function(t, e, r) {
            var n = this.that,
            i = n.iRenderB,
            o = i.getContRight()[0],
            a = o[r ? "scrollWidth": "scrollHeight"],
            l = o[r ? "scrollLeft": "scrollTop"],
            s = 1e3 > a ? 1 : 1 + (a - 1e3) / a;
            t = Math.pow(t, s);
            var d = l + (e ? t: -t);
            i[r ? "scrollX": "scrollY"](d)
        }
    }
} (jQuery),
function(t) {
    var e = t.paramquery;
    e.cFormula = function(t) {
        var e = this;
        e.that = t,
        e.oldF = [],
        t.one("ready",
        function() {
            t.on("CMInit", e.onCMInit(e))
        }).on("dataAvailable",
        function() {
            e.onDA()
        }).on(!0, "change",
        function(t, r) {
            e.onChange(r)
        })
    },
    e.cFormula.prototype = {
        onCMInit: function(t) {
            return function() {
                t.isFormulaChange(t.oldF, t.formulas()) && t.calcMainData()
            }
        },
        callRow: function(t, e, r) {
            var n = this.that,
            i = 0;
            if (t) for (i = 0; r > i; i++) {
                var o = e[i],
                a = o[0],
                l = o[1];
                t[a.dataIndx] = l.call(n, t, a)
            }
        },
        onDA: function() {
            this.calcMainData()
        },
        isFormulaChange: function(t, e) {
            var r = !1,
            n = 0,
            i = t.length,
            o = e.length;
            if (i == o) {
                for (; i > n; n++) if (t[n][0] != e[n][0]) {
                    r = !0;
                    break
                }
            } else r = !0;
            return r
        },
        calcMainData: function() {
            var t = this.formulaSave(),
            e = this.that,
            r = t.length;
            if (r) {
                for (var n = e.options,
                i = n.dataModel.data,
                o = i.length; o--;) this.callRow(i[o], t, r);
                e._trigger("formulaComputed")
            }
        },
        onChange: function(t) {
            var e = this.formulas(),
            r = e.length,
            n = this,
            i = function(t) {
                n.callRow(t.rowData, e, r)
            };
            r && (t.addList.forEach(i), t.updateList.forEach(i))
        },
        formulas: function() {
            var t, e, r = this.that,
            n = [],
            i = r.options.formulas || [];
            return i.forEach(function(i) {
                t = r.getColumn({
                    dataIndx: i[0]
                }),
                t && (e = i[1], e && n.push([t, e]))
            }),
            n
        },
        formulaSave: function() {
            var t = this.formulas();
            return this.oldF = t,
            t
        }
    }
} (jQuery),
function(t) {
    var e = t.paramquery;
    e.pqGrid.defaults.treeModel = {
        cbId: "pq_tree_cb",
        childstr: "children",
        iconCollapse: ["ui-icon-triangle-1-se", "ui-icon-triangle-1-e"],
        iconFolder: ["ui-icon-folder-open", "ui-icon-folder-collapsed"],
        iconFile: "ui-icon-document",
        id: "id",
        indent: 18,
        parentId: "parentId",
        refreshOnChange: !0
    },
    e.pqGrid.prototype.Tree = function() {
        return this.iTree
    },
    t(document).on("pqGrid:bootup",
    function(t, e) {
        var n = e.instance;
        n.iTree = new r(n)
    });
    var r = e.cTree = function(t) {
        this.that = t,
        this.fns = {},
        this.init(),
        this.cache = {},
        this.di_prev
    };
    r.prototype = {
        _cascadeNest: function(t, e) {
            for (var r, n, i, o = this,
            a = o.cbId,
            l = o.prop,
            s = o.parentId,
            d = o.childstr,
            c = t.length,
            u = 0; c > u; u++) n = t[u],
            n[l] && (r = !0, o.eachChild(n, o.chkEachChild(a, e, n[a], l)), delete n[l]),
            (i = n[d]) && i.length && o._cascadeNest(i, e);
            r && null != n[s] && o.eachParent(n, o.chkEachParent(a, e, l))
        },
        addNodes: function(t, e) {
            var r, n, i = this,
            o = i.that,
            a = o.options.dataModel,
            l = i.parentId,
            s = e ? e[i.id] : null,
            d = 0,
            c = [];
            if (t) {
                for (r = t.length; r > d; d++) n = t[d],
                null != s && (n[l] = s),
                c.push({
                    newRow: n
                });
                o._digestData({
                    addList: c,
                    history: !1
                }),
                a.data = i.groupById(a.data),
                i.buildCache(),
                o.refreshView()
            }
        },
        buildCache: function() {
            for (var t, e, r = this,
            n = r.that.options,
            i = n.dataModel.data,
            o = r.cache,
            a = r.id,
            l = 0,
            s = i.length; s > l; l++) {
                if (t = i[l], e = t[a], null == e) throw "unknown id of row";
                o[e] = t
            }
        },
        checkNodes: function(t, e, r) {
            null == r && (r = !0);
            for (var n, i, o = 0,
            a = t.length,
            l = [], s = {
                check: r
            },
            d = this, c = d.that, u = c.riOffset, h = d.cbId, f = d.prop, p = c.options.treeModel, g = p.cascade, v = p.select; a > o; o++) n = t[o],
            i = n.pq_ri,
            l.push({
                rowData: n,
                rowIndx: i,
                rowIndxPage: i - u
            });
            if (s.rows = l, c._trigger("beforeCheck", e, s) !== !1 && (l = s.rows, a = l.length)) {
                for (o = 0; a > o; o++) n = l[o].rowData,
                this.isEditable(n) && (n[h] = r, v && (n.pq_rowselect = r), g && (n[f] = !0));
                g && d._cascadeNest(d.getRoots(), v),
                c._trigger("check", e, s),
                c.refresh()
            }
        },
        chkEachChild: function(t, e, r, n) {
            return function(i) {
                n && i[n] || this.isEditable(i) && (i[t] = r, e && (i.pq_rowselect = r))
            }
        },
        chkEachParent: function(t, e) {
            var r = this.childstr;
            return function(n) {
                for (var i, o, a = n[r], l = 0, s = 0, d = 0, c = a.length; c > d; d++) {
                    if (o = a[d][t]) l++;
                    else {
                        if (null === o) {
                            i = null;
                            break
                        }
                        s++
                    }
                    if (l && s) {
                        i = null;
                        break
                    }
                }
                void 0 === i && (i = !!l),
                this.isEditable(n) && (n[t] = i, e && (n.pq_rowselect = i))
            }
        },
        collapseAll: function(t) {
            this[t ? "expandNodes": "collapseNodes"](this.that.options.dataModel.data)
        },
        collapseNodes: function(t, e, r) {
            for (var n, i, o = 0,
            a = this.that,
            l = t.length,
            s = [], d = !r; l > o; o++) n = t[o],
            this.isFolder(n) && this.isCollapsed(n) !== d && s.push(n);
            if (s.length && (i = {
                close: d,
                nodes: s
            },
            a._trigger("beforeTreeExpand", e, i) !== !1)) {
                for (l = s.length, o = 0; l > o; o++) n = s[o],
                n.pq_close = d;
                a._trigger("treeExpand", e, i),
                a.refreshView()
            }
        },
        eachParent: function(t, e) {
            for (; t = this.getParent(t);) e.call(this, t)
        },
        eachChild: function(t, e) {
            e.call(this, t);
            for (var r, n = this.childstr,
            i = t[n] || [], o = 0, a = i.length; a > o; o++) r = i[o],
            e.call(this, r),
            r[n] && this.eachChild(r, e)
        },
        expandAll: function() {
            this.collapseAll(!0)
        },
        expandNodes: function(t, e) {
            this.collapseNodes(t, e, !0)
        },
        expandTo: function(t) {
            var e = [];
            do t.pq_close && e.push(t);
            while (t = this.getParent(t));
            this.expandNodes(e)
        },
        exportCell: function(t, e) {
            for (var r = "",
            n = 0; e > n; n++) r += "- ";
            return r + (null == t ? "": t)
        },
        filter: function(t, e, r, n, i, o) {
            for (var a, l, s, d, c = this.childstr,
            u = 0,
            h = t.length; h > u; u++) a = t[u],
            l = !1,
            (d = a[c]) && (l = this.filter(d, e, r, n, i, o), l && (s = !0, i.push(a))),
            l || (r.isMatchRow(a, e, n) ? (s = !0, i.push(a)) : o.push(a));
            return s
        },
        _flatten: function(t, e, r, n) {
            for (var i, o, a = this,
            l = t.length,
            s = a.id,
            d = a.parentId,
            c = 0,
            u = a.childstr; l > c; c++) i = t[c],
            i.pq_level = r,
            n.push(i),
            e && (i[d] = e[s]),
            o = i[u],
            o && a._flatten(o, i, r + 1, n)
        },
        flatten: function(t) {
            var e = [];
            return this._flatten(t, null, 0, e),
            e
        },
        getFormat: function() {
            for (var t, e, r = this,
            n = r.that.options.dataModel.data,
            i = "flat",
            o = 0,
            a = n.length,
            l = r.parentId,
            s = r.childstr; a > o && (t = n[o], null == t[l]); o++) if ((e = t[s]) && e.length) return r.getParent(e[0]) == t ? "flat": "nested";
            return i
        },
        getAllChildren: function(t, e) {
            for (var r, n = this.childstr,
            i = t[n] || [], o = i.length, a = 0, l = e || []; o > a; a++) r = i[a],
            l.push(r),
            r[n] && this.getAllChildren(r, l);
            return l
        },
        getCheckedNodes: function() {
            for (var t, e = this.that.options.dataModel.data,
            r = e.length,
            n = 0,
            i = [], o = this.cbId; r > n; n++) t = e[n],
            t[o] && i.push(t);
            return i
        },
        getLevel: function(t) {
            return t.pq_level
        },
        getNode: function(t) {
            return this.cache[t]
        },
        getParent: function(t) {
            var e = t[this.parentId];
            return this.cache[e]
        },
        getRoots: function(t) {
            for (var e, r = this.that,
            n = t || r.options.dataModel.data,
            i = n.length,
            o = 0,
            a = []; i > o; o++) e = n[o],
            e.pq_level || a.push(e);
            return a
        },
        _groupById: function(t, e, r, n, i) {
            for (var o, a = this,
            l = a.childstr,
            s = 0,
            d = r.length; d > s; s++) {
                var c = r[s],
                u = c[e];
                c.pq_level = i,
                t.push(c),
                (o = n[u]) ? (c[l] = o, a._groupById(t, e, o, n, i + 1)) : delete c[l]
            }
        },
        groupById: function(t) {
            for (var e, r, n, i = this,
            o = i.id,
            a = i.parentId,
            l = {},
            s = [], d = 0, c = t.length; c > d; d++) n = t[d],
            e = n[a],
            null == e && (e = ""),
            (r = l[e]) || (r = l[e] = []),
            r.push(n);
            return i._groupById(s, o, l[""] || [], l, 0),
            s
        },
        init: function() {
            var t = this,
            e = t.that,
            r = e.options,
            n = r.treeModel,
            i = n.cbId,
            o = t.dataIndx = n.dataIndx;
            t.cbId = i,
            t.prop = "pq_tree_prop",
            t.id = n.id,
            t.parentId = n.parentId,
            t.childstr = n.childstr,
            o ? t._init || (t.on("CMInit", t.onColInit(t, e, n)).on("dataAvailable", t.onDataAvailable(t, e, n)).on("dataReady", t.onDataReady(t, e, n)).on("beforeCellKeyDown", t.onBeforeCellKeyDown(t, e)).on("customSort", t.onCustomSort(t, e)).on("customFilter", t.onCustomFilter(t, e)).on("clearFilter", t.onClearFilter(t)).on("change", t.onChange(t, e, n)).on("cellClick", t.onCellClick(t, e)).on("refresh refreshRow", t.onRefresh(t, n)).on("valChange", t.onCheckbox(t, n)), t._init = !0) : t._init && (this.off(), t._init = !1),
            t._init && (r.groupModel.on = n.summary)
        },
        initData: function() {
            var t = this,
            e = t.that,
            r = e.options,
            n = r.dataModel,
            i = n.data;
            i = "flat" == t.getFormat() ? t.groupById(i) : t.flatten(i),
            n.data = i,
            t.buildCache()
        },
        isEditable: function(t) {
            return ! 0
        },
        isFolder: function(t) {
            return null != t.pq_close || !!t[this.childstr]
        },
        isCollapsed: function(t) {
            return !! t.pq_close
        },
        off: function() {
            var t, e = this.fns,
            r = this.that;
            for (t in e) r.off(t, e[t]);
            this.fns = {}
        },
        on: function(t, e) {
            return this.fns[t] = e,
            this.that.on(t, e),
            this
        },
        onCustomSort: function(t) {
            return function(e, r) {
                var n = t.getRoots(r.data);
                return t.sort(n, r.sort_composite),
                r.data = t.flatten(n),
                !1
            }
        },
        onColInit: function(t) {
            return function() {
                t.setCellRender()
            }
        },
        onCellClick: function(e) {
            return function(r, n) {
                n.dataIndx == e.dataIndx && t(r.originalEvent.target).hasClass("pq-group-icon") && e.toggleNode(n.rowData, r)
            }
        },
        onBeforeCellKeyDown: function(e, r) {
            return function(n, i) {
                var o, a, l = i.rowData,
                s = i.dataIndx,
                d = n.keyCode,
                c = t.ui.keyCode;
                if (s == e.dataIndx) {
                    if (e.isFolder(l) && (a = l.pq_close, d == c.ENTER && !r.isEditableCell({
                        rowData: l,
                        dataIndx: s
                    }) || !a && d == c.LEFT || a && d == c.RIGHT)) return e.toggleNode(l),
                    !1;
                    if (d == c.SPACE && (o = r.getCell(i).find("input[type='checkbox']"), o.length)) return o.click(),
                    !1
                }
            }
        },
        onChange: function(t, e, r) {
            return function() {
                r.summary && r.refreshOnChange && e.refreshView()
            }
        },
        onRefresh: function(t, e) {
            return function() {
                if (e.checkbox) for (var t = this.$cont.find(".pq_indeter"), r = t.length; r--;) t[r].indeterminate = !0
            }
        },
        onClearFilter: function(t) {
            return function(e, r) {
                return r.data = t.groupById(r.data),
                !1
            }
        },
        onCustomFilter: function(t, e) {
            return function(r, n) {
                var i = t.groupById(n.data),
                o = e.iFilterData,
                a = n.filters,
                l = [],
                s = [],
                d = n.mode;
                return t.filter(t.getRoots(i), a, o, d, l, s),
                n.dataTmp = t.groupById(l),
                n.dataUF = s,
                !1
            }
        },
        onCheckbox: function(t, e) {
            return function(r, n) {
                e.checkbox && n.dataIndx == e.dataIndx && t.checkNodes([n.rowData], r, n.input.checked)
            }
        },
        onDataAvailable: function(t) {
            return function() {
                t.initData()
            }
        },
        onDataReady: function(t, e, r) {
            return function() {
                r.summary && t.summary(t),
                t.showHideRows(),
                r.cascade && r.checkbox && t.refreshCascade()
            }
        },
        option: function(e, r) {
            var n, i = this,
            o = i.that,
            a = o.options.treeModel,
            l = a.dataIndx;
            t.extend(a, e),
            n = a.dataIndx,
            i.setCellRender(),
            i.init(),
            !l && n && i.initData(),
            r !== !1 && o.refreshView()
        },
        refreshCascade: function() {
            var t = this,
            e = t.prop,
            r = [],
            n = t.that;
            n.pdata.forEach(function(n) {
                t.isFolder(n) || (n[e] = !0, r.push(n))
            }),
            t._cascadeNest(t.getRoots(), n.options.treeModel.select)
        },
        _summary: function(t, e, r, n, i, o) {
            for (var a, l, s, d, c, u = this,
            h = u.childstr,
            f = 0,
            p = t.length,
            g = 0,
            v = {},
            m = {},
            w = u.id,
            x = u.parentId,
            y = r.length,
            C = pq.aggregate; y > g; g++) c = r[g],
            v[c] = [];
            for (; p > f; f++) for (l = t[f], a = null, e.push(l), (s = l[h]) && (a = u._summary(s, e, r, n, i, l)), g = 0; y > g; g++) c = r[g],
            a && v[c].push(a[c]),
            v[c].push(l[c]);
            for (g = 0; y > g; g++) c = r[g],
            d = n[g],
            m[c] = C[d](v[c], i[g]);
            return l && l.pq_level && (m.pq_level = l.pq_level, m.pq_gsummary = !0, o && (m[x] = o[w]), e.push(m)),
            m
        },
        summary: function(t) {
            for (var e, r, n = t.that,
            i = t.getRoots(), o = [], a = [], l = [], s = [], d = 0, c = n.colModel, u = c.length; u > d; d++) e = c[d],
            r = e.summary,
            r && r.type && (l.push(e.dataIndx), s.push(e), a.push(r.type));
            t._summary(i, o, l, a, s),
            n.pdata = o
        },
        _iconCls: function(t, e, r) {
            if (r.icons) {
                var n;
                if (e && (n = r.iconFolder)) return t.pq_close ? n[1] : n[0];
                if (!t.pq_gsummary) return r.iconFile
            }
        },
        renderCB: function(t, e, r, n) {
            if (e.pq_gsummary) return "";
            var i = this.that,
            o = "",
            a = "";
            return "function" == typeof t && (t = t.call(i, e)),
            t ? (e[n] && (o = "checked"), null === e[n] && (a = "class='pq_indeter'"), "<input type='checkbox' " + r + " " + a + " " + o + "/>") : void 0
        },
        renderCell: function(t, e) {
            return function(r) {
                var n, i, o, a, l, s = r.rowData,
                d = t.that,
                c = e.indent,
                u = e.render,
                h = e.iconCollapse,
                f = e.checkbox,
                p = t.isFolder(s),
                g = t._iconCls(s, p, e),
                v = s.pq_level || 0,
                m = v * c,
                w = m + 1 * c,
                x = ["pq-group-title-cell"],
                y = ["text-indent:", p ? m: w, "px;"],
                C = "style='width:" + c + "px;'",
                _ = r.cellData;
                if (u) {
                    var I = d.callFn(u, r);
                    null != I && ("string" != typeof I ? (I.iconCls && (g = I.iconCls), null != I.text && (_ = I.text), a = I.attr, x.push(I.cls), y.push(I.style)) : _ = I)
                }
                return r.Export ? t.exportCell(_, v) : (f && (l = t.renderCB(f, s, C, e.cbId)), p && (i = s.pq_close ? h[1] : h[0], n = "<span " + C + " class='pq-group-icon ui-icon " + i + "'></span>"), g && (o = "<span " + C + " class='pq-tree-icon ui-icon " + g + "'></span>"), {
                    cls: x.join(" "),
                    attr: a,
                    style: y.join(""),
                    text: [n, o, l, _].join("")
                })
            }
        },
        setCellRender: function() {
            var t, e, r = this,
            n = r.that,
            i = n.options.treeModel,
            o = n.columns;
            i.summary && n.iGroup.refreshColumns(),
            (t = r.di_prev) && (e = o[t], e && (e._render = null), r.di_prev = null),
            (t = i.dataIndx) && (e = o[t], e._render = r.renderCell(r, i), r.di_prev = t)
        },
        _showHideRows: function(t, e, r) {
            for (var n, i, o, a = this,
            l = e || a.getRoots(), s = a.childstr, d = r || !1, c = l.length, u = 0; c > u; u++) n = l[u],
            n.pq_hidden = d,
            (o = n[s]) && (i = d || n.pq_close, a._showHideRows(t, o, i))
        },
        showHideRows: function() {
            var t, e, r = this,
            n = r.that,
            i = 0,
            o = n.get_p_data(),
            a = n.options.treeModel.summary;
            if (r._showHideRows(o), a) for (o = n.pdata, t = o.length; t > i; i++) e = o[i],
            e.pq_gsummary && (e.pq_hidden = r.getParent(e).pq_hidden)
        },
        sort: function(t, e) {
            var r = this.childstr; !
            function n(t) {
                t.sort(e);
                for (var i, o = t.length,
                a = 0; o > a; a++)(i = t[a][r]) && n(i)
            } (t)
        },
        toggleNode: function(t, e) {
            this[t.pq_close ? "expandNodes": "collapseNodes"]([t], e)
        },
        unCheckNodes: function(t, e) {
            this.checkNodes(t, e, !1)
        }
    }
} (jQuery),
function(t) {
    var e = t.paramquery,
    r = e.pqGrid.prototype,
    n = function(t) {
        this.that = t;
        var e = t.options;
        this.options = e,
        this.selection = [],
        this.hclass = " pq-state-select " + (e.bootstrap.on ? "": "ui-state-highlight")
    };
    e.cRows = n,
    r.SelectRow = function() {
        return this.iRows
    },
    n.prototype = {
        _add: function(t, e) {
            var r, n = this.that,
            i = t.rowIndxPage,
            o = !e,
            a = t.rowData,
            l = this.inViewRow(i);
            return ! a.pq_hidden && l && (r = n.getRow(t), r.length && (r[o ? "addClass": "removeClass"](this.hclass), !o && r.removeAttr("tabindex"))),
            a.pq_rowselect = o,
            t
        },
        _data: function(t) {
            t = t || {};
            var e = this.that,
            r = t.all,
            n = e.riOffset,
            i = r ? 0 : n,
            o = e.get_p_data(),
            a = r ? o.length: e.pdata.length,
            l = i + a;
            return [o, i, l]
        },
        add: function(t) {
            var e = t.addList = t.rows || [{
                rowIndx: t.rowIndx
            }];
            t.isFirst && this.setFirst(e[0].rowIndx),
            this.update(t)
        },
        extend: function(t) {
            var e, r, n, i, o, a = t.rowIndx,
            l = [],
            s = this.getFirst();
            if (null != s) {
                if (o = this.isSelected({
                    rowIndx: s
                }), null == o) return;
                for (s > a ? (s = [a, a = s][0], n = s, i = a - 1) : (n = s + 1, i = a), e = n; i >= e; e++) r = {
                    rowIndx: e
                },
                l.push(r);
                this.update(o ? {
                    addList: l
                }: {
                    deleteList: l
                })
            }
        },
        getFirst: function() {
            return this._firstR
        },
        getSelection: function() {
        	// DTS 第二页获取行BUG
            for (var t, e = this.that,
            r = e.pdata/*e.get_p_data()*/, n = 0, i = r.length, o = []; i > n; n++) t = r[n],
            t.pq_rowselect && o.push({
                rowIndx: n,
                rowData: t
            });
            return o
        },
        inViewRow: function(t) {
            var e = this.that,
            r = e.options,
            n = e.iRenderB,
            i = r.freezeRows;
            return i > t ? !0 : t >= n.initV && t <= n.finalV
        },
        isSelected: function(t) {
            var e = t.rowData || this.that.getRowData(t);
            return e ? e.pq_rowselect === !0 : null
        },
        isSelectedAll: function(t) {
            for (var e, r = this._data(t), n = r[0], i = r[1], o = r[2]; o > i; i++) if (e = n[i], e && !e.pq_rowselect) return ! 1;
            return ! 0
        },
        removeAll: function(t) {
            this.selectAll(t, !0)
        },
        remove: function(t) {
            var e = t.deleteList = t.rows || [{
                rowIndx: t.rowIndx
            }];
            t.isFirst && this.setFirst(e[0].rowIndx),
            this.update(t)
        },
        selectAll: function(t, e) {
            for (var r, n = this.that,
            i = [], o = n.riOffset, a = this._data(t), l = a[0], s = a[1], d = a[2]; d > s; s++) r = l[s],
            r && i.push({
                rowIndx: s,
                rowIndxPage: s - o,
                rowData: r
            });
            this.update(e ? {
                deleteList: i
            }: {
                addList: i
            },
            !0)
        },
        setFirst: function(t) {
            this._firstR = t
        },
        toRange: function() {
            for (var t, e, r, n = [], i = this.that, o = i.get_p_data(), a = 0, l = o.length; l > a; a++) t = o[a],
            t.pq_rowselect ? null != e ? r = a: e = r = a: null != e && (n.push({
                r1: e,
                r2: r
            }), e = r = null);
            return null != e && n.push({
                r1: e,
                r2: r
            }),
            i.Range(n)
        },
        toggle: function(t) {
            this[this.isSelected(t) ? "remove": "add"](t)
        },
        toggleAll: function(t) {
            this[this.isSelectedAll(t) ? "removeAll": "selectAll"](t)
        },
        update: function(t, e) {
            var r = this,
            n = r.that,
            i = {
                source: t.source
            },
            o = function(t) {
                return e ? t: n.normalizeList(t)
            },
            a = o(t.addList || []),
            l = o(t.deleteList || []);
            if (a = a.filter(function(t) {
                return r.isSelected(t) === !1
            }), l = l.filter(function(t) {
                return r.isSelected(t)
            }), a.length || l.length) {
                if (i.addList = a, i.deleteList = l, n._trigger("beforeRowSelect", null, i) === !1) return;
                i.addList.forEach(function(t) {
                    r._add(t)
                }),
                i.deleteList.forEach(function(t) {
                    r._add(t, !0)
                }),
                n._trigger("rowSelect", null, i)
            }
        }
    }
} (jQuery),
function(t) {
    var e = t.paramquery;
    t(document).on("pqGrid:bootup",
    function(t, e) {
        var n = e.instance;
        n.iImport = new r(n)
    }),
    e.pqGrid.prototype.importWb = function(t) {
        return this.iImport.importWb(t)
    };
    var r = e.cImport = function(t) {
        this.that = t
    };
    r.prototype = {
        fillRows: function(t, e, r) {
            for (var n = t.length; e > n; n++) t.push(r ? {}: [])
        },
        generateCols: function(t, e, r) {
            var n, i, o = pq.toLetter,
            a = [],
            l = 0,
            s = pq.excel.colWidth,
            d = r ? r.cells: [],
            c = [];
            for (d.forEach(function(t, e) {
                var r = t.indx || e;
                c[r] = t.value
            }), e = e || [], e.forEach(function(t, e) {
                var r = t.indx || e;
                a[r] = {
                    hidden: t.hidden,
                    width: t.width,
                    title: c[r] || ""
                }
            }), t = Math.max(t, e.length); t > l; l++) n = a[l] || {},
            i = {
                title: n.title || o(l),
                width: n.width || s,
                halign: "center"
            },
            n.hidden && (i.hidden = !0),
            a[l] = i;
            return a
        },
        importS: function(t, e, r, n, i) {
            var o, a, l, s, d, c, u = t.mergeCells,
            h = this,
            f = [],
            p = this.that,
            g = 0,
            v = t.rows,
            m = t.frozenRows || 0,
            w = v.length,
            x = 0,
            y = p.options.colModel,
            C = y && y.length;
            for (null != i && (c = v[i], v = v.slice(i + 1), m -= i + 1, m = m > 0 ? m: 0), x = 0, w = v.length; w > x; x++) o = v[x],
            a = o.indx || x,
            l = {},
            a != x && this.fillRows(f, a, !0),
            o.cells.forEach(function(t, e) {
                s = t.indx || e,
                d = n && C && y[s] ? y[s].dataIndx: s,
                l[d] = t.value,
                h.copyStyle(l, d, t),
                t.format && h.copyFormat(l, d, t.format),
                t.formula && h.copyFormula(l, d, t.formula),
                s >= g && (g = s + 1)
            }),
            o.hidden && (l.pq_hidden = !0),
            f[a] = l;
            t.name && p.option("title", t.name),
            e && this.fillRows(f, f.length + e, !0),
            p.option("dataModel.data", f),
            g += r || 0,
            p.refreshCM(this.generateCols(g, t.columns, c)),
            p.option("mergeCells", (u || []).map(function(t) {
                return pq.getAddress(t)
            })),
            p.option({
                freezeRows: m,
                freezeCols: t.frozenCols
            }),
            p.refreshDataAndView(),
            p._trigger("importWb")
        },
        copyFormula: function(t, e, r) {
            var n = t.pq_fn = t.pq_fn || {};
            n[e] = r
        },
        copyFormat: function(t, e, r) {
            var n = t.pq_format = t.pq_format || {};
            r = pq.isDateFormat(r) ? pq.excelToJui(r) : pq.excelToNum(r),
            n[e] = r
        },
        copyStyle: function(t, e, r) {
            var n, i, o = []; (n = r.font) && o.push("font-family:" + n),
            (n = r.fontSize) && o.push("font-size:" + n + "px"),
            (n = r.color) && o.push("color:" + n),
            (n = r.bgColor) && o.push("background:" + n),
            r.bold && o.push("font-weight:bold"),
            r.italic && o.push("font-style:italic"),
            r.underline && o.push("text-decoration:underline"),
            (n = r.align) && o.push("text-align:" + n),
            (n = r.valign) && o.push("vertical-align:" + n),
            r.wrap && o.push("white-space:normal"),
            (o = o.join(";")) && (i = t.pq_cellattr = t.pq_cellattr || {},
            i[e] = {
                style: o
            })
        },
        importWb: function(t) {
            var e = t.workbook,
            r = t.sheet || 0,
            n = e.sheets.filter(function(t, e) {
                return r == e || r == t.name
            })[0];
            n && this.importS(n, t.extraRows, t.extraCols, t.keepCM, t.headerRowIndx)
        }
    }
} (jQuery),
function(t) {
    pq.excelImport = {
        attr: function() {
            var t = new RegExp('([a-z]+)\\s*=\\s*"([^"]*)"', "gi");
            return function(e) {
                e = e || "",
                e = e.slice(0, e.indexOf(">"));
                var r = {};
                return e.replace(t,
                function(t, e, n) {
                    r[e] = n
                }),
                r
            }
        } (),
        cacheStyles: function() {
            var e, r, n, i = this,
            o = t(t.parseXML(i.getStyleText())),
            a = t.extend(!0, {},
            i.preDefFormats),
            l = [],
            s = [""],
            d = ["", ""];
            o.find("numFmts>numFmt").each(function(e, r) {
                var n = t(r),
                i = n.attr("formatCode");
                a[n.attr("numFmtId")] = i
            }),
            o.find("fills>fill>patternFill>fgColor[rgb]").each(function(e, r) {
                var n = i.getColor(t(r).attr("rgb"));
                d.push(n)
            }),
            o.find("fonts>font").each(function(n, o) {
                var a = t(o),
                l = 1 * a.find("sz").attr("val"),
                d = a.find("name").attr("val"),
                c = a.find("color").attr("rgb"),
                u = {};
                return 0 === n ? (e = l, void(r = d.toUpperCase())) : (a.find("b").length && (u.bold = !0), c && (u.color = i.getColor(c)), d && d.toUpperCase() != r && (u.font = d), l && l != e && (u.fontSize = l), a.find("u").length && (u.underline = !0), a.find("i").length && (u.italic = !0), void s.push(u))
            }),
            o.find("cellXfs>xf").each(function(e, r) {
                var i, o, c, u, h = t(r),
                f = 1 * h.attr("numFmtId"),
                p = 1 * h.attr("fillId"),
                g = h.children("alignment"),
                v = 1 * h.attr("fontId"),
                m = v ? s[v] : {},
                w = {};
                g.length && (i = g.attr("horizontal"), i && (w.align = i), o = g.attr("vertical"), o && (w.valign = o), c = g.attr("wrapText"), "1" == c && (w.wrap = !0)),
                f && (n = a[f], /(?=.*m.*)(?=.*d.*)(?=.*y.*)/i.test(n) && (n = n.replace(/(\[.*\]|[^mdy\/\-\s])/gi, "")), w.format = n),
                p && d[p] && (w.bgColor = d[p]);
                for (u in m) w[u] = m[u];
                l.push(w)
            }),
            i.getStyle = function(t) {
                return l[t]
            },
            o = 0
        },
        getMergeCells: function(t) {
            var e = this,
            r = t.match(/<mergeCell\s+.*?(\/>|<\/mergeCell>)/g) || [];
            return r.map(function(t) {
                return e.attr(t).ref
            })
        },
        getFrozen: function(t) {
            var e = this.match(t, /<pane.*?(\/>|<\/pane>)/, 0),
            r = this.attr(e),
            n = 1 * r.xSplit,
            i = 1 * r.ySplit;
            return {
                r: i || 0,
                c: n || 0
            }
        },
        getFormula: function(e) {
            var r = {},
            n = t.paramquery.cFormulas.shiftRC();
            return function(t, i, o) {
                if ("<f" === t.substr(0, 2)) {
                    var a, l = e.match(t, /^<f.*?>(.*?)<\/f>/, 1),
                    s = e.attr(t);
                    return "shared" == s.t && (l ? r[s.si] = {
                        r: i,
                        c: o,
                        f: l
                    }: (a = r[s.si], l = n(a.f, o - a.c, i - a.r))),
                    l
                }
            }
        },
        getCols: function(t) {
            for (var e = this,
            r = (t.match(/<dimension\s.*?\/>/) || [])[0], n = e.attr(r || "").ref, i = [], o = t.match(/<col\s.*?\/>/g) || [], a = n ? pq.getAddress(n).c2 + 1 : o.length, l = pq.excel.colRatio, s = 0; a > s; s++) for (var d, c = o[s], u = e.attr(c), h = 1 * u.min, f = 1 * u.max, p = 1 * u.hidden, g = 1 * u.width, v = h; f >= v; v++) d = {},
            p ? d.hidden = !0 : d.width = 1 * (g * l).toFixed(2),
            v !== i.length + 1 && (d.indx = v - 1),
            i.push(d);
            return i
        },
        getColor: function(t) {
            return "#" + t.slice(2)
        },
        getPath: function(t) {
            return this.paths[t]
        },
        getPathSheets: function() {
            return this.pathSheets
        },
        getFileTextFromKey: function(t) {
            return this.getFileText(this.getPath(t))
        },
        getFileText: function(t) {
            return this.files[t.replace(/^\//, "")].asText()
        },
        getSheetText: function(t) {
            t = t || 0;
            var e = this.pathSheets.filter(function(e, r) {
                return e.name === t || r === t
            })[0].path;
            return this.getFileText(e)
        },
        getStyleText: function() {
            return this.getFileTextFromKey("st")
        },
        getSI: function(t) {
            var e, r = [],
            n = pq.unescapeXml,
            i = 1 * this.attr(this.match(t, /<sst.*?>[\s\S]*?<\/sst>/, 0)).uniqueCount;
            if (t.replace(/<si>([\s\S]*?)<\/si>/g,
            function(t, i) {
                e = [],
                i.replace(/<t.*?>([\s\S]*?)<\/t>/g,
                function(t, r) {
                    e.push(r)
                }),
                r.push(n(e.join("")))
            }), i && i !== r.length) throw "si misatch";
            return r
        },
        getWorkBook: function(t, e, r) {
            var n = this,
            i = {};
            e ? i[e] = !0 : "string" == typeof t && (i.base64 = !0),
            n.files = new JSZip(t, i).files,
            this.readPaths(),
            this.cacheStyles();
            var o = this.getPath("ss"),
            a = [],
            l = o ? this.getSI(this.getFileText(o)) : [];
            return n.getPathSheets().forEach(function(t, e) {
                if (!r || r.indexOf(e) > -1 || r.indexOf(t.name) > -1) {
                    var i = n.getFileText(t.path),
                    o = n.match(i, /<sheetData.*?>(.*?)<\/sheetData>/, 1),
                    s = n.getWorkSheet(i, o, l, t.name);
                    a.push(s)
                }
            }),
            delete n.files,
            {
                sheets: a
            }
        },
        getWorkSheet: function(t, e, r, n) {
            for (var i, o, a, l, s, d, c, u, h, f, p, g, v, m, w, x, y, C = this,
            _ = [], I = 0, b = pq.toNumber, q = this.getFormula(C), R = pq.isEmpty, D = pq.formulas, M = pq.isDateFormat, T = C.getMergeCells(t), E = e.match(/<row.*?<\/row>/g) || [], S = 0, P = E.length; P > S; S++) {
                d = {
                    cells: []
                },
                w = E[S],
                v = C.attr(w),
                y = v.r,
                x = y ? y - 1 : S,
                x !== S && (d.indx = x),
                v.hidden && (d.hidden = !0),
                c = w.match(/(<c[^<]*?\/>|<c.*?<\/c>)/g) || [];
                for (var k = 0,
                A = c.length; A > k; k++) {
                    if (o = c[k], m = C.attr(o), u = m.t, g = C.match(o, /<c.*?>(.*?)(<\/c>)?$/, 1), s = {},
                    "inlineStr" == u ? f = g.match(/<t><!\[CDATA\[(.*?)\]\]><\/t>/)[1] : (f = C.match(g, /<v>(.*?)<\/v>/, 1) || void 0, null != f && (f = "s" == u ? r[f] : "str" == u ? pq.unescapeXml(f) : "b" == u ? "1" == f: D.VALUE(f))), p = m.r, p ? (p = p.replace(/\d+/, ""), p = b(p)) : p = k, I = I > p ? I: p, void 0 !== f && (s.value = f), p !== k && (s.indx = p), a = q(g, x, p), a && (s.formula = pq.unescapeXml(a)), h = m.s, h && (h = this.getStyle(h))) {
                        for (i in h) s[i] = h[i];
                        l = s.format,
                        null != f && !a && l && M(l) && (s.value = D.TEXT(f, "m/d/yyyy"))
                    } ! R(s) && d.cells.push(s)
                }
                _.push(d)
            }
            var H = {
                rows: _,
                name: n
            },
            F = C.getCols(t),
            $ = C.getFrozen(t);
            return T.length && (H.mergeCells = T),
            F.length && (H.columns = F),
            $.r && (H.frozenRows = $.r),
            $.c && (H.frozenCols = $.c),
            H
        },
        Import: function(t, e) {
            var r, n, i, o = this,
            a = t.file,
            l = t.content,
            s = t.url,
            d = function(r, n) {
                e(o.getWorkBook(r, t.type || n, t.sheets))
            };
            s ? (n = "?" + Math.random(), window.Uint8Array ? (i = new XMLHttpRequest, i.open("GET", s + n, !0), i.responseType = "arraybuffer", i.onload = function(t) {
                200 == this.status && d(i.response)
            },
            i.send()) : JSZipUtils.getBinaryContent(s + n,
            function(t, e) {
                d(e, "binary")
            })) : a ? (r = new FileReader, r.onload = function(t) {
                d(t.target.result)
            },
            r.readAsArrayBuffer(a)) : l && d(l)
        },
        match: function(t, e, r) {
            var n = t.match(e);
            return n ? n[r] : ""
        },
        preDefFormats: {
            1 : "0",
            2 : "0.00",
            3 : "#,##0",
            4 : "#,##0.00",
            5 : "$#,##0_);($#,##0)",
            6 : "$#,##0_);[Red]($#,##0)",
            7 : "$#,##0.00_);($#,##0.00)",
            8 : "$#,##0.00_);[Red]($#,##0.00)",
            9 : "0%",
            10 : "0.00%",
            11 : "0.00E+00",
            12 : "# ?/?",
            13 : "# ??/??",
            14 : "m/d/yyyy",
            15 : "d-mmm-yy",
            16 : "d-mmm",
            17 : "mmm-yy",
            18 : "h:mm AM/PM",
            19 : "h:mm:ss AM/PM",
            20 : "h:mm",
            21 : "h:mm:ss",
            22 : "m/d/yyyy h:mm",
            37 : "#,##0_);(#,##0)",
            38 : "#,##0_);[Red](#,##0)",
            39 : "#,##0.00_);(#,##0.00)",
            40 : "#,##0.00_);[Red](#,##0.00)",
            45 : "mm:ss",
            46 : "[h]:mm:ss",
            47 : "mm:ss.0",
            48 : "##0.0E+0",
            49 : "@"
        },
        readPaths: function() {
            var e = this.files,
            r = t(t.parseXML(e["[Content_Types].xml"].asText())),
            n = this.paths = {
                wb: "sheet.main",
                ws: "worksheet",
                st: "styles",
                ss: "sharedStrings"
            };
            for (var i in n) n[i] = r.find('[ContentType$="' + n[i] + '+xml"]').attr("PartName");
            for (i in e) if (/workbook.xml.rels$/.test(i)) {
                n.wbrels = i;
                break
            }
            var o = t(this.getFileTextFromKey("wbrels")),
            a = t(this.getFileTextFromKey("wb")),
            l = this.pathSheets = [];
            a.find("sheet").each(function(e, n) {
                var i = t(n),
                a = i.attr("r:id"),
                s = i.attr("name"),
                d = o.find('[Id="' + a + '"]').attr("Target"),
                c = r.find('Override[PartName$="' + d + '"]').attr("PartName");
                l.push({
                    name: s,
                    rId: a,
                    path: c
                })
            })
        }
    }
} (jQuery),
function(t) {
    var e = t.paramquery,
    r = e._pqGrid.prototype;
    r.exportExcel = function(t) {
        return t = t || {},
        t.format = "xlsx",
        this.exportData(t)
    },
    r.exportCsv = function(t) {
        return t = t || {},
        t.format = "csv",
        this.exportData(t)
    },
    r.exportData = function(t) {
        var e = new n(this, t);
        return e.Export(t)
    };
    var n = e.cExport = function(t, e) {
        this.that = t
    };
    n.prototype = t.extend({
        copyStyle: function(t, e) {
            var r, n, i, o, a, l, s;
            "string" == typeof e && (s = e.split(";"), e = {},
            s.forEach(function(t) {
                t && (s = t.split(":"), s[0] && s[1] && (e[s[0].trim()] = s[1].trim()))
            })),
            (r = e.background) && (t.bgColor = r),
            (n = e["font-size"]) && (t.fontSize = parseFloat(n)),
            (o = e.color) && (t.color = o),
            "normal" == e["white-space"] && (t.wrap = !0),
            (a = e["text-align"]) && (t.align = a),
            (l = e["vertical-align"]) && (t.valign = l),
            "bold" == e["font-weight"] && (t.bold = !0),
            (i = e["font-family"]) && (t.font = i),
            "italic" == e["font-style"] && (t.italic = !0),
            "underline" == e["text-decoration"] && (t.underline = !0)
        },
        getExportCM: function(t, e) {
            return e > 1 ? t: t.filter(function(t) {
                return 0 != t.copy
            })
        },
        Export: function(t) {
            var e, r = this,
            n = r.that,
            i = n.options,
            o = i.groupModel,
            a = "remote" == i.pageModel.type,
            l = n.riOffset,
            s = n.iRenderB,
            d = n.iMerge,
            c = n.headerCells,
            u = c.length,
            h = r.getExportCM(n.colModel, u),
            f = h.length,
            p = i.treeModel,
            g = o.on && o.dataIndx.length || a || p.dataIndx && p.summary,
            v = g ? n.pdata: i.dataModel.data,
            v = i.summaryData ? v.concat(i.summaryData) : v,
            m = v.length,
            w = t.render,
            x = !t.noheader,
            y = t.format;
            if (n._trigger("beforeExport", null, t) === !1) return ! 1;
            if ("xlsx" == y) {
                var C = r.getWorkbook(h, f, c, u, v, m, a, l, d, w, s, x, t.sheetName);
                return n._trigger("workbookReady", null, {
                    workbook: C
                }) === !1 ? C: t.workbook ? C: (t.workbook = C, pq.excel.exportWb(t))
            }
            return "json" == y ? t.data = r.getJsonContent(t, v) : "csv" == y ? t.data = r.getCSVContent(t, h, f, c, u, v, m, a, l, d, w, s, x) : t.data = r.getHtmlContent(t, h, f, c, u, v, m, a, l, d, w, s, x),
            e = e || r.postRequest(t),
            n._trigger("exportData", null, t),
            e
        },
        getTitle: function(t, e) {
            var r = t.title;
            return r ? "function" == typeof r && (r = r.call(this.that, {
                colIndx: e,
                column: t,
                dataIndx: t.dataIndx,
                Export: !0
            })) : r = "",
            r
        },
        getXlsMergeCells: function(t, e, r, n) {
            t = t.concat(r.getMergeCells(e, this.curPage, n));
            for (var i = [], o = pq.toLetter, a = t.length, l = 0; a > l; l++) {
                var s = t[l];
                s = o(s.c1) + (s.r1 + 1) + ":" + o(s.c2) + (s.r2 + 1),
                i.push(s)
            }
            return i
        },
        getXlsCols: function(t, e) {
            for (var r, n, i, o = [], a = 0, l = pq.excel.colWidth; e > a; a++) n = t[a],
            i = 1 * (n._width || l).toFixed(2),
            r = {},
            i !== l && (r.width = i),
            n.hidden && (r.hidden = !0),
            pq.isEmpty(r) || (o.length !== a && (r.indx = a), o.push(r));
            return o
        },
        getXlsHeader: function(t, e, r) {
            for (var n = this,
            i = [], o = 0; e > o; o++) {
                for (var a = t[o], l = [], s = 0, d = a.length; d > s; s++) {
                    var c = a[s];
                    if (c.copy !== !1) {
                        var u = c.o_colspan,
                        h = c.rowSpan,
                        f = n.getTitle(c, s);
                        o > 0 && c == t[o - 1][s] ? f = "": s > 0 && c == t[o][s - 1] ? f = "": (u > 1 || h > 1) && r.push({
                            r1: o,
                            c1: s,
                            r2: o + h - 1,
                            c2: s + u - 1
                        }),
                        l.push({
                            value: f,
                            bgColor: "#eeeeee"
                        })
                    }
                }
                i.push({
                    cells: l
                })
            }
            return i
        },
        getXlsBody: function(e, r, n, i, o, a, l, s, d) {
            var c, u, h, f, p, g, v, m, w, x, y, C, _, I, b, q, R, D, M, T = this,
            E = T.that,
            S = [];
            for (u = 0; i > u; u++) {
                for (C = n[u], y = [], _ = o ? u + a: u, I = _ - a, m = {
                    rowIndx: _,
                    rowIndxPage: I,
                    rowData: C,
                    Export: !0
                },
                h = 0; r > h; h++) v = e[h],
                b = v.dataIndx,
                D = C.pq_cellattr,
                g = C[b],
                f = g,
                p = E.getFormula(C, b),
                c = !1,
                l.ismergedCell(_, h) && (l.isRootCell(_, h, "o") || (c = !0)),
                c || p || (m.colIndx = h, m.column = v, m.dataIndx = b, w = T.getRenderVal(m, s, d), f = w[0], x = w[1]),
                M = T.getCellFormat(C, b) || v.format,
                M && (pq.isDateFormat(M) ? (f !== g && t.datepicker.formatDate(M, new Date(g)) === f && (f = g), M = pq.juiToExcel(M)) : (f !== g && pq.formatNumber(g, M) === f && (f = g), M = pq.numToExcel(M))),
                R = {},
                void 0 !== f && (R.value = f),
                D && (D = D[b]) && (D = D.style) && T.copyStyle(R, D),
                x && T.copyStyle(R, x),
                p && (R.formula = p),
                M && (R.format = M),
                pq.isEmpty(R) || (R.dataIndx = b, y.length !== h && (R.indx = h), y.push(R));
                q = {},
                y.length && (q.cells = y),
                C.pq_hidden && (q.hidden = !0),
                pq.isEmpty(q) || (S.length !== u && (q.indx = u), S.push(q))
            }
            return S
        },
        getCellFormat: function(t, e) {
            var r = t.pq_format;
            return r && r[e]
        },
        getWorkbook: function(t, e, r, n, i, o, a, l, s, d, c, u, h) {
            var f, p = this,
            g = p.getXlsCols(t, e),
            v = [],
            m = p.that.options,
            w = m.freezeCols,
            x = m.freezeRows || 0,
            x = u ? n + x: x,
            y = u ? p.getXlsHeader(r, n, v) : [],
            C = p.getXlsMergeCells(v, u ? n: 0, s, o),
            _ = p.getXlsBody(t, e, i, o, a, l, s, d, c),
            I = {
                columns: g,
                rows: y.concat(_)
            };
            return C.length && (I.mergeCells = C),
            (f = y.length) && (I.headerRows = f),
            x && (I.frozenRows = x),
            w && (I.frozenCols = w),
            (h || (h = m.title)) && (I.name = h),
            {
                sheets: [I]
            }
        },
        getHtmlHeader: function(t, e) {
            for (var r, n, i, o, a, l = this,
            s = [], d = 0; e > d; d++) {
                var c = t[d],
                u = null;
                s.push("<tr>");
                for (var h = 0,
                f = c.length; f > h; h++) r = c[h],
                n = r.colSpan,
                !r.hidden && n && r.copy !== !1 && (i = r.rowSpan, d > 0 && r == t[d - 1][h] || u && h > 0 && r == u || (o = l.getTitle(r, h), u = r, a = r.halign || r.align, a = a ? "align=" + a: "", s.push("<th colspan=", n, " rowspan=", i, " ", a, ">", o, "</th>")));
                s.push("</tr>")
            }
            return s.join("")
        },
        getHtmlBody: function(t, e, r, n, i, o, a, l, s) {
            var d, c, u, h, f, p, g, v, m, w, x, y, C, _, I = this,
            b = [];
            for (d = 0; n > d; d++) if (m = r[d], !m.pq_hidden) {
                for (w = i ? d + o: d, x = w - o, v = {
                    rowIndx: w,
                    rowIndxPage: x,
                    rowData: m,
                    Export: !0
                },
                b.push("<tr>"), c = 0; e > c; c++) if (u = t[c], !u.hidden && u.copy !== !1) {
                    if (h = null, f = null, C = "", a.ismergedCell(w, c)) {
                        if (! (f = a.isRootCell(w, c))) continue;
                        h = a.getRootCellO(w, c),
                        h.Export = !0,
                        p = I.getRenderVal(h, l, s),
                        y = p[0],
                        g = p[1],
                        C = "rowspan=" + f.rowspan + " colspan=" + f.colspan + " "
                    } else v.colIndx = c,
                    v.column = u,
                    v.dataIndx = u.dataIndx,
                    p = I.getRenderVal(v, l, s),
                    y = p[0],
                    g = p[1];
                    _ = u.align,
                    C += _ ? "align=" + _: "",
                    y = null == y ? "": y,
                    y = pq.newLine(y),
                    b.push("<td ", C, g ? ' style="' + g + '"': "", ">", y, "</td>")
                }
                b.push("</tr>")
            }
            return b.join("")
        },
        getHtmlContent: function(t, e, r, n, i, o, a, l, s, d, c, u, h) {
            var f = this,
            p = f.that,
            g = t.cssRules || "",
            v = p.element.find(".pq-grid-table"),
            m = v.css("font-family"),
            w = v.css("font-size"),
            x = "table{empty-cells:show;font-family:" + m + ";font-size:" + w + ";border-collapse:collapse;}",
            y = [];
            return y.push("<!DOCTYPE html><html><head>", '<meta charset="utf-8" />', "<title>", t.title ? t.title: "ParamQuery Pro", "</title>", "</head><body>", "<style>", x, "td,th{padding: 5px;border:1px solid #ccc;}", g, "</style>", "<table>"),
            y.push(h ? f.getHtmlHeader(n, i, e) : ""),
            y.push(f.getHtmlBody(e, r, o, a, l, s, d, c, u)),
            y.push("</table></body></html>"),
            y.join("")
        },
        getCsvHeader: function(t, e, r, n) {
            for (var i, o, a, l = this,
            s = [], d = [], c = 0; e > c; c++) {
                for (var u = t[c], h = null, f = 0, p = u.length; p > f; f++) i = r[f],
                i.hidden || i.copy === !1 || (o = u[f], c > 0 && o == t[c - 1][f] ? s.push("") : h && f > 0 && o == h ? s.push("") : (a = l.getTitle(o, f), a = a ? a.replace(/\"/g, '""') : "", h = o, s.push('"' + a + '"')));
                d.push(s.join(n)),
                s = []
            }
            return d
        },
        getCSVContent: function(t, e, r, n, i, o, a, l, s, d, c, u, h) {
            var f, p, g, v, m, w, x, y, C, _, I, b = this,
            q = t.separator || ",",
            R = [];
            for (I = h ? b.getCsvHeader(n, i, e, q) : [], v = 0; a > v; v++) if (x = o[v], !x.pq_hidden) {
                y = l ? v + s: v,
                C = y - s,
                w = {
                    rowIndx: y,
                    rowIndxPage: C,
                    rowData: x,
                    Export: !0
                };
                for (var m = 0; r > m; m++) if (_ = e[m], !_.hidden && _.copy !== !1) {
                    p = null,
                    f = null,
                    d.ismergedCell(y, m) ? (f = d.isRootCell(y, m)) ? (p = d.getRootCellO(y, m), p.Export = !0, g = b.getRenderVal(p, c, u)[0]) : g = "": (w.colIndx = m, w.column = _, w.dataIndx = _.dataIndx, g = b.getRenderVal(w, c, u)[0]);
                    var D = (null == g ? "": g) + "";
                    D = D.replace(/\"/g, '""'),
                    R.push('"' + D + '"')
                }
                I.push(R.join(q)),
                R = []
            }
            return "\ufeff" + I.join("\n")
        },
        getJsonContent: function(t, e) {
            function r(t, e) {
                return 0 !== (t + "").indexOf("pq_") ? e: void 0
            }
            return t.nostringify ? e: JSON.stringify(e, t.nopqdata ? r: null, t.nopretty ? null: 2)
        },
        postRequest: function(e) {
            var r, n, i = e.format,
            o = e.url,
            a = e.filename || "pqGrid";
            if (e.zip && "xlsx" != i) {
                var l = new JSZip;
                l.file(a + "." + e.format, e.data),
                r = l.generate({
                    type: "base64",
                    compression: "DEFLATE"
                }),
                n = !0,
                i = "zip"
            } else n = !!e.decodeBase,
            r = e.data;
            return o && t.ajax({
                url: o,
                type: "POST",
                cache: !1,
                data: {
                    pq_ext: i,
                    pq_data: r,
                    pq_decode: n,
                    pq_filename: a
                },
                success: function(e) {
                    o += (o.indexOf("?") > 0 ? "&": "?") + "pq_filename=" + e,
                    t(document.body).append("<iframe height='0' width='0' frameborder='0' src=\"" + o + '"></iframe>')
                }
            }),
            r
        }
    },
    pq.mixin.render)
} (jQuery);
var objEx = pq.excel = {
    _tmpl: {
        rels: '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="workbook.xml"/></Relationships>'
    },
    eachRow: function(t, e) {
        for (var r = t.rows,
        n = 0,
        i = r.length; i > n; n++) e(r[n], n)
    },
    exportWb: function(t) {
        var e = t.workbook,
        r = this._tmpl,
        n = this,
        i = [],
        o = e.sheets,
        a = o.length,
        l = new JSZip;
        l.file("[Content_Types].xml", this.getContentTypes(a)),
        o.forEach(function(t, e) {
            var r = n.getCols(t.columns),
            o = n.getFrozen(t.frozenRows, t.frozenCols),
            a = n.getBody(t.rows),
            s = n.getMergeCells(t.mergeCells);
            i.push(t.name),
            l.file("worksheet" + (e + 1) + ".xml", n.getSheet(o, r, a, s))
        }),
        l.file("workbook.xml", this.getWBook(i)),
        l.file("styles.xml", n.getStyle());
        var s = l.folder("_rels");
        return s.file(".rels", r.rels),
        s.file("workbook.xml.rels", this.getWBookRels(a)),
        t.url ? (t.data = l.generate({
            type: "base64",
            compression: "DEFLATE"
        }), t.decodeBase = !0, pq.postRequest(t)) : l.generate({
            type: t.type || "blob",
            compression: "DEFLATE"
        })
    },
    eachCell: function(t, e) {
        t.forEach(function(t) {
            var r; (r = t.cells) ? r.forEach(e) : (r = t.rows) && this.eachCell(r, e)
        },
        this)
    },
    getArray: function(t) {
        var e = [],
        r = this;
        return this.eachRow(t,
        function(t) {
            var n = [];
            t.cells.forEach(function(t) {
                n.push(r.getCell(t))
            }),
            e.push(n)
        }),
        e
    },
    getBody: function(t) {
        var e, r, n, i, o, a, l, s, d, c, u, h, f, p, g, v, m, w, x, y, C, _, I, b, q, R, D = this,
        M = pq.formulas,
        T = [],
        E = t.length;
        for (e = 0; E > e; e++) {
            for (f = t[e], u = f.cells, b = u.length, q = f.hidden ? 'hidden="1"': "", n = (f.indx || e) + 1, o = 'r="' + n + '"', T.push("<row " + q + " " + o + ">"), r = 0; b > r; r++) c = u[r],
            h = c.value,
            i = c.indx || r,
            a = "",
            l = "",
            o = i === r ? "": 'r="' + pq.toLetter(i) + n + '"',
            R = c.format,
            p = c.bgColor,
            g = c.color,
            v = c.font,
            m = c.fontSize,
            C = c.bold,
            _ = c.italic,
            I = c.underline,
            w = c.align,
            x = c.wrap,
            y = c.valign,
            d = c.formula,
            d = d ? "<f>" + pq.escapeXml(d) + "</f>": "",
            null == h ? s = "<v></v>": h == parseFloat(h) ? s = "<v>" + h + "</v>": R && M.isDate(h) ? s = "<v>" + M.VALUE(h) + "</v>": "boolean" == typeof h ? (s = "<v>" + (h ? "1": "0") + "</v>", a = 't="b"') : (a = 't="inlineStr"', s = "<is><t><![CDATA[" + h + "]]></t></is>"),
            (R || p || g || m || w || y || x || C || _ || I) && (l = 's="' + D.getStyleIndx(R, p, g, v, m, w, y, x, C, _, I) + '"'),
            T.push("<c " + a + " " + o + " " + l + ">" + d + s + "</c>");
            T.push("</row>")
        }
        return T.join("")
    },
    getCell: function(t) {
        var e = t.format,
        r = t.value;
        return e ? pq.formulas.TEXT(r, e) : r
    },
    getCSV: function(t) {
        var e = [],
        r = this;
        return this.eachRow(t,
        function(t) {
            var n = [];
            t.cells.forEach(function(t) {
                n.push(r.getCell(t))
            }),
            e.push(n.join(","))
        }),
        e.join("\r\n")
    },
    getColor: function() {
        var t = {},
        e = function(t) {
            return 1 === t.length ? "0" + t: t
        };
        return function(r) {
            var n, i, o = t[r];
            if (o || (/^#[0-9,a,b,c,d,e,f]{6}$/i.test(r) ? i = r.replace("#", "") : (n = r.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/i)) && (i = e((1 * n[1]).toString(16)) + e((1 * n[2]).toString(16)) + e((1 * n[3]).toString(16))), i && 6 === i.length && (o = t[r] = "ff" + i)), o) return o;
            throw "invalid color: " + r
        }
    } (),
    _getCol: function(t, e, r, n, i) {
        if (i) {
            if (i == this.colWidth && !n) return;
            i = 1 * (i / this.colRatio).toFixed(2),
            i = ' customWidth="1" width="' + i + '"'
        }
        t.push('<col min="', e, '" max="', r, '" hidden="', n, '"', i, "/>")
    },
    getCols: function(t) {
        if (!t || !t.length) return "";
        var e, r, n, i, o = [],
        a = 0,
        l = 0,
        s = 0,
        d = t.length;
        for (o.push("<cols>"); d > s; s++) {
            var c = t[s],
            u = c.hidden ? 1 : 0,
            h = c.width,
            f = c.indx;
            a = (f || a) + 1,
            n === h && i === u && a == l + 1 ? r = a: (a > 1 && (this._getCol(o, e, r, i, n), e = null), r = a, null == e && (e = a)),
            n = h,
            i = u,
            l = a
        }
        return this._getCol(o, e, r, i, n),
        o.push("</cols>"),
        o.join("")
    },
    getContentTypes: function(t) {
        for (var e = [], r = 1; t >= r; r++) e.push('<Override PartName="/worksheet' + r + '.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>');
        return ['<?xml version="1.0" encoding="UTF-8" standalone="yes"?>', '<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">', '<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>', '<Override PartName="/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>', e.join(""), '<Override PartName="/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>', "</Types>"].join("")
    },
    getFillIndx: function(t) {
        var e = this,
        r = e.fills = e.fills || {
            length: 2
        };
        return e.getIndx(r, t)
    },
    getFontIndx: function(t, e, r, n, i, o) {
        var a = this,
        l = a.fonts = a.fonts || {
            length: 1
        };
        return a.getIndx(l, (t || "") + "_" + (e || "") + "_" + (r || "") + "_" + (n || "") + "_" + (i || "") + "_" + (o || ""))
    },
    getFormatIndx: function(t) {
        var e = this,
        r = e.formats = e.formats || {
            length: 164
        };
        return e.numFmtIds[t] || e.getIndx(r, t)
    },
    getFrozen: function(t, e) {
        t = t || 0,
        e = e || 0;
        var r = pq.toLetter(e) + (t + 1);
        return ['<sheetViews><sheetView workbookViewId="0">', '<pane xSplit="', e, '" ySplit="', t, '" topLeftCell="', r, '" activePane="bottomLeft" state="frozen"/>', "</sheetView></sheetViews>"].join("")
    },
    getIndx: function(t, e) {
        var r = t[e];
        return null == r && (r = t[e] = t.length, t.length++),
        r
    },
    getMergeCells: function(t) {
        t = t || [];
        var e = [],
        r = 0,
        n = t.length;
        for (e.push('<mergeCells count="' + n + '">'); n > r; r++) e.push('<mergeCell ref="', t[r], '"/>');
        return e.push("</mergeCells>"),
        n ? e.join("") : ""
    },
    getWBook: function(t) {
        return ['<?xml version="1.0" encoding="UTF-8" standalone="yes"?><workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">', "<bookViews><workbookView /></bookViews><sheets>", t.map(function(t, e) {
            return e++,
            ["=tiffu obnf>#".replace(/[^\s]/g,
            function(t) {
                return String.fromCharCode(t.charCodeAt(0) - 1)
            }), "RctcoSwgt{ Gxcn ".replace(/[^\s]/g,
            function(t) {
                return String.fromCharCode(t.charCodeAt(0) - 2)
            }) + e, '" sheetId="', e, '" r:id="rId', e, '"/>'].join("")
        }).join(""), "</sheets></workbook>"].join("")
    },
    getWBookRels: function(t) {
        for (var e = [], r = 1; t >= r; r++) e.push('<Relationship Id="rId' + r + '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="/worksheet' + r + '.xml"/>');
        return ['<?xml version="1.0" encoding="UTF-8" standalone="yes"?>', '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">', e.join(""), '<Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="/styles.xml"/>', "</Relationships>"].join("")
    },
    getSheet: function(t, e, r, n) {
        return ['<?xml version="1.0" encoding="UTF-8" standalone="yes"?><worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">', t, e, "<sheetData>", r, "</sheetData>", n, "</worksheet>"].join("")
    },
    getStyleIndx: function(t, e, r, n, i, o, a, l, s, d, c) {
        var u = this,
        h = t ? u.getFormatIndx(t) : "",
        f = e ? u.getFillIndx(e) : "",
        p = r || n || i || s || d || c ? u.getFontIndx(r, n, i, s, d, c) : "",
        g = h + "_" + f + "_" + p + "_" + (o || "") + "_" + (a || "") + "_" + (l || ""),
        v = u.styles = u.styles || {
            length: 1
        };
        return u.getIndx(v, g)
    },
    getStyle: function() {
        var t, e, r, n, i, o, a, l, s, d, c, u, h, f, p, g, v, m, w = this.formats,
        x = this.fills,
        y = this.fonts,
        C = this.styles,
        _ = [],
        I = [],
        b = [],
        q = ['<xf numFmtId="0" applyNumberFormat="1"/>'];
        if (w) {
            delete w.length;
            for (m in w) _.push('<numFmt numFmtId="' + w[m] + '" formatCode="' + m + '"/>');
            delete this.formats
        }
        if (x) {
            delete x.length;
            for (m in x) I.push('<fill><patternFill patternType="solid"><fgColor rgb="' + this.getColor(m) + '"/></patternFill></fill>');
            delete this.fills
        }
        if (y) {
            delete y.length;
            for (m in y) a = m.split("_"),
            t = "<color " + (a[0] ? 'rgb="' + this.getColor(a[0]) + '"': 'theme="1"') + " />",
            r = '<name val="' + (a[1] || "Calibri") + '"/>',
            e = '<sz val="' + (a[2] || 11) + '"/>',
            n = a[3] ? "<b/>": "",
            i = a[4] ? "<i/>": "",
            o = a[5] ? "<u/>": "",
            b.push("<font>", n, i, o, e, t, r, '<family val="2"/></font>');
            delete this.fonts
        }
        if (C) {
            delete C.length;
            for (m in C) a = m.split("_"),
            l = a[0],
            s = a[1],
            d = a[2],
            c = a[3],
            u = a[4],
            h = a[5],
            f = s ? ' applyFill="1" fillId="' + s + '" ': "",
            g = d ? ' applyFont="1" fontId="' + d + '" ': "",
            p = l ? ' applyNumberFormat="1" numFmtId="' + l + '"': "",
            c = c ? ' horizontal="' + c + '" ': "",
            u = u ? ' vertical="' + u + '" ': "",
            h = h ? ' wrapText="1" ': "",
            v = c || u || h ? ' applyAlignment="1"><alignment ' + c + u + h + "/></xf>": "/>",
            q.push("<xf " + p + f + g + v);
            delete this.styles
        }
        return _ = _.join("\n"),
        q = q.join("\n"),
        I = I.join("\n"),
        b = b.join(""),
        ['<?xml version="1.0" encoding="UTF-8" standalone="yes"?>', '<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">', "<numFmts>", _, "</numFmts>", "<fonts>", '<font><sz val="11"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font>', b, "</fonts>", '<fills><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill>', I, "</fills>", '<borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>', '<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/>', "</cellStyleXfs>", "<cellXfs>", q, "</cellXfs>", '<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>', '<dxfs count="0"/><tableStyles count="0" defaultTableStyle="TableStyleMedium9" defaultPivotStyle="PivotStyleLight16"/>', "</styleSheet>"].join("")
    },
    importXl: function() {
        var t = pq.excelImport;
        return t.Import.apply(t, arguments)
    }
};
objEx.colRatio = 8,
objEx.colWidth = 8.43 * objEx.colRatio,
objEx.numFmtIds = function() {
    var t = pq.excelImport.preDefFormats,
    e = {};
    for (var r in t) e[t[r]] = r;
    return e
} (),
pq.postRequest = function(t) {
    var e, r, n = t.format,
    i = t.url,
    o = t.filename || "pqGrid";
    if (t.zip && "xlsx" != n) {
        var a = new JSZip;
        a.file(o + "." + t.format, t.data),
        e = a.generate({
            type: "base64",
            compression: "DEFLATE"
        }),
        r = !0,
        n = "zip"
    } else r = !!t.decodeBase,
    e = t.data;
    return i && $.ajax({
        url: i,
        type: "POST",
        cache: !1,
        data: {
            pq_ext: n,
            pq_data: e,
            pq_decode: r,
            pq_filename: o
        },
        success: function(t) {
            i += (i.indexOf("?") > 0 ? "&": "?") + "pq_filename=" + t,
            $(document.body).append("<iframe height='0' width='0' frameborder='0' src=\"" + i + '"></iframe>')
        }
    }),
    e
},
function($) {
    var _pq = $.paramquery;
    _pq.pqGrid.defaults.formulasModel = {
        on: !0
    },
    _pq.pqGrid.prototype.getFormula = function(t, e) {
        var r = this.iFormulas.getFnW(t, e);
        return r ? r.fn: void 0
    },
    $(document).on("pqGrid:bootup",
    function(t, e) {
        var r = e.instance,
        n = r.options.formulasModel;
        n.on && (r.iFormulas = new cFormulas(r))
    });
    var cFormulas = _pq.cFormulas = function(t) {
        var e = this;
        e.that = t,
        e.fn = {},
        t.on("dataReadyDone",
        function() {
            e.onDataReadyDone()
        }).on("columnOrder",
        function() {
            e.onColumnOrder()
        }).on("beforeValidateDone",
        function(t, r) {
            e.onBeforeValidateDone(r)
        }).on("autofillSeries",
        function(t, r) {
            e.onAutofill(r)
        }).on("editorBegin",
        function(t, r) {
            e.onEditorBegin(r)
        }).on("editorEnd",
        function() {
            e.onEditorEnd()
        }).on("editorKeyUp editorClick",
        function(t, r) {
            e.onEditorKeyUp(t, r)
        }).on(!0, "change",
        function(t, r) {
            e.onChange(r)
        })
    };
    $.extend(cFormulas, {
        deString: function(t, e, r) {
            var n = [];
            return t = t.replace(/"(([^"]|"")+)"/g,
            function(t, e) {
                return n.push(e),
                "#" + (n.length - 1) + "#"
            }),
            t = e(t),
            n.forEach(function(e, n) {
                r && (e = e.replace(/""/g, '\\"')),
                t = t.replace("#" + n + "#", '"' + e + '"')
            }),
            t
        },
        selectExp: function(t, e) {
            var r, n, i, o, a = t.slice(0, e).replace(/"[^"]*"/g, "");
            return ! /"[^"]+$/.test(a) && (i = t.slice(e), (r = a.match(/.*?([a-z0-9:$]+)$/i)) && ("" === i && (n = []) || (n = i.match(/^([a-z0-9:$]+)?.*/i)))) ? o = (r[1] + (null == n[1] ? "": n[1])).replace(/\$/g, "").toUpperCase() : void 0
        },
        shiftRC: function(t) {
            var e = cFormulas,
            r = t ? t.get_p_data().length - 1 : 0,
            n = t ? t.colModel.length - 1 : 0;
            return function(t, i, o) {
                return i && (t = e.shiftC(t, i, n)),
                o && (t = e.shiftR(t, o, r)),
                t
            }
        },
        shiftR: function(t, e, r) {
            return cFormulas.deString(t,
            function(t) {
                return t = t.replace(/(\$?)([A-Z]+)(\$?)([\d]+)/g,
                function(t, n, i, o, a) {
                    if (o) return t;
                    var l = 1 * a + e - 1;
                    return l = 0 > l ? 0 : r && l > r ? r: l,
                    n + i + (l + 1)
                }),
                t.replace(/(\$?)([0-9]+):(\$?)([0-9]+)/g,
                function(t, n, i, o, a) {
                    var l;
                    return n || (l = 1 * i + e - 1, l = 0 > l ? 0 : r && l > r ? r: l, i = l + 1),
                    o || (l = 1 * a + e - 1, l = 0 > l ? 0 : r && l > r ? r: l, a = l + 1),
                    n + i + ":" + o + a
                })
            })
        },
        shiftC: function(t, e, r) {
            return cFormulas.deString(t,
            function(t) {
                return t = t.replace(/(\$?)([A-Z]+)(\$?)([\d]+)/g,
                function(t, n, i, o, a) {
                    if (n) return t;
                    var l = pq.toNumber(i) + e;
                    return l = 0 > l ? 0 : r && l > r ? r: l,
                    pq.toLetter(l) + o + a
                }),
                t.replace(/(\$?)([A-Z]+):(\$?)([A-Z]+)/g,
                function(t, n, i, o, a) {
                    var l;
                    return n || (l = pq.toNumber(i) + e, l = 0 > l ? 0 : r && l > r ? r: l, i = pq.toLetter(l)),
                    o || (l = pq.toNumber(a) + e, l = 0 > l ? 0 : r && l > r ? r: l, a = pq.toLetter(l)),
                    n + i + ":" + o + a
                })
            })
        }
    }),
    cFormulas.prototype = {
        addRowIndx: function(t) {
            t.forEach(function(t) {
                var e, r, n = t.newRow,
                i = n.pq_fn;
                if (i) for (r in i) e = i[r],
                e.ri = e.riO = n.pq_ri
            })
        },
        cell: function(t) {
            var e = this.toCell(t),
            r = e.r,
            n = e.c;
            return this.valueArr(r, n)[0]
        },
        check: function(t) {
            return cFormulas.deString(t,
            function(t) {
                return t = t.split(" ").join(""),
                t.toUpperCase().replace(/([A-Z]+)([0-9]+)\:([A-Z]+)([0-9]+)/g,
                function(t, e, r, n, i) {
                    return e = pq.toNumber(e),
                    n = pq.toNumber(n),
                    e > n && (e = [n, n = e][0]),
                    1 * r > 1 * i && (r = [i, i = r][0]),
                    pq.toLetter(e) + r + ":" + pq.toLetter(n) + i
                })
            })
        },
        computeAll: function() {
            var t, e = this,
            r = e.that;
            e.initObj(),
            e.eachFormula(function(e) {
                e.clean = 0,
                t = !0
            }),
            t && e.eachFormula(function(t, n, i, o, a) {
                n[i] = e.execIfDirty(t),
                a && r.isValid({
                    rowIndx: o,
                    rowData: n,
                    dataIndx: i,
                    allowInvalid: !0
                })
            })
        },
        eachFormula: function(t) {
            var e = this,
            r = !0,
            n = e.that,
            i = function(e, n, i) {
                var o, a;
                for (o in i) a = i[o],
                "string" != typeof a && t(a, e, o, n, r)
            },
            o = function(t) {
                t = t || [];
                for (var e, r, n = t.length; n--;)(e = t[n]) && (r = e.pq_fn) && i(e, n, r)
            };
            o(n.get_p_data()),
            r = !1,
            o(n.options.summaryData)
        },
        execIfDirty: function(t) {
            if (t.clean) {
                if (.5 == t.clean) return
            } else t.clean = .5,
            t.val = this.exec(t.fn, t.ri, t.ci),
            t.clean = 1;
            return t.val
        },
        exec: function(_fn, r, c) {
            var self = this,
            obj = self.obj,
            fn = cFormulas.deString(_fn,
            function(t) {
                return t = t.replace(/(\$?([A-Z]+)?\$?([0-9]+)?\:\$?([A-Z]+)?\$?([0-9]+)?)/g,
                function(t, e) {
                    return obj[e] = obj[e] || self.range(e),
                    "obj['" + e + "']"
                }),
                t = t.replace(/(?:[^:]|^)(\$?[A-Z]+\$?[0-9]+)(?!:)/g,
                function(t, e) {
                    obj[e] = obj[e] || self.cell(e);
                    var r = t.charAt(0);
                    return (t === e ? "": "$" == r ? "": r) + e
                }),
                t = t.replace(/{/g, "[").replace(/}/g, "]").replace(/(?:[^><])(=+)/g,
                function(t, e) {
                    return t + (1 === e.length ? "=": "")
                }).replace(/<>/g, "!=").replace(/&/g, "+")
            },
            !0);
            with(obj.getRange = function() {
                return {
                    r1: r,
                    c1: c
                }
            },
            obj) {
                try {
                    var v = eval(fn);
                    "function" == typeof v ? v = "#NAME?": "string" == typeof v && cFormulas.deString(v,
                    function(t) {
                        t.indexOf("function") >= 0 && (v = "#NAME?")
                    }),
                    v !== v && (v = null)
                } catch(ex) {
                    v = "string" == typeof ex ? ex: ex.message
                }
                return v
            }
        },
        initObj: function() {
            this.obj = $.extend({
                iFormula: this
            },
            pq.formulas)
        },
        onAutofill: function(t) {
            var e = t.sel,
            r = this,
            n = r.that,
            i = e.r,
            o = e.c,
            a = t.x,
            l = n.getRowData({
                rowIndx: i
            }),
            s = n.colModel,
            d = s.length - 1,
            c = n.get_p_data().length - 1,
            u = s[o].dataIndx,
            h = r.getFnW(l, u);
            h && (t.series = function(t) {
                return "=" + (a ? cFormulas.shiftC(h.fn, t - 1, d) : cFormulas.shiftR(h.fn, t - 1, c))
            })
        },
        onBeforeValidateDone: function(t) {
            var e = this,
            r = this.that.colIndxs,
            n = function(n) {
                n.forEach(function(n) {
                    var i, o, a, l = n.newRow,
                    s = n.rowData;
                    for (o in l) if (i = l[o], "string" == typeof i && "=" === i[0]) {
                        t.allowInvalid = !0;
                        var d = e.check(i),
                        c = s ? e.getFnW(s, o) : null;
                        c ? d !== c.fn && (n.oldRow[o] = "=" + c.fn, e.save(s, o, d, n.rowIndx, r[o])) : e.save(s || l, o, d, n.rowIndx, r[o])
                    } else s && (a = e.remove(s, o)) && (n.oldRow[o] = "=" + a.fn)
                })
            };
            n(t.addList),
            n(t.updateList)
        },
        onChange: function(t) {
            this.addRowIndx(t.addList),
            t.addList.length || t.deleteList.length || (this.computeAll(), "edit" === t.source && this.that.refresh())
        },
        onColumnOrder: function() {
            var t, e, r = this,
            n = r.that,
            i = cFormulas.shiftRC(n),
            o = n.colIndxs;
            r.eachFormula(function(r, n, a) {
                t = o[a],
                r.ci != t && (e = t - r.ciO, r.ci = t, r.fn = i(r.fnOrig, e, r.ri - r.riO))
            }),
            null != t && r.computeAll()
        },
        onEditorBegin: function(t) {
            var e = this.getFnW(t.rowData, t.dataIndx);
            e && t.$editor.val("=" + e.fn)
        },
        onEditorEnd: function() {
            pq.intel.hide()
        },
        onEditorKeyUp: function(t, e) {
            var r = e.$editor,
            n = r[0],
            i = n.value,
            o = pq.intel,
            a = n.selectionEnd;
            i && 0 === i.indexOf("=") && (o.popup(i, a, r), this.select(i, a))
        },
        onDataReadyDone: function() {
            var t, e = this,
            r = e.that,
            n = cFormulas.shiftRC(r),
            i = r.colIndxs,
            o = function(r, o, a) {
                var l, s, d;
                for (s in a) l = a[s],
                t = !0,
                "string" == typeof l ? e.save(r, s, e.check(l), o, i[s]) : l.ri != o && (d = o - l.riO, l.ri = o, l.fn = n(l.fnOrig, l.ci - l.ciO, d))
            },
            a = function(t) {
                t = t || [];
                for (var e, r, n = t.length; n--;)(e = t[n]) && (r = e.pq_fn) && o(e, n, r)
            };
            a(r.get_p_data()),
            a(r.options.summaryData),
            e.initObj(),
            t && e.computeAll()
        },
        getFnW: function(t, e) {
            var r;
            return (r = t.pq_fn) ? r[e] : void 0
        },
        remove: function(t, e) {
            var r, n = t.pq_fn;
            return n && (r = n[e]) ? (delete n[e], pq.isEmpty(n) && delete t.pq_fn, r) : void 0
        },
        range: function(t) {
            var e = t.split(":"),
            r = this.that,
            n = this.toCell(e[0]),
            i = n.r,
            o = n.c,
            a = this.toCell(e[1]),
            l = a.r,
            s = a.c;
            return this.valueArr(null == i ? 0 : i, null == o ? 0 : o, null == l ? r.get_p_data().length - 1 : l, null == s ? r.colModel.length - 1 : s)
        },
        save: function(t, e, r, n, i) {
            var o, a = r.replace(/^=/, ""),
            l = {
                clean: 0,
                fn: a,
                fnOrig: a,
                riO: n,
                ciO: i,
                ri: n,
                ci: i
            };
            return o = t.pq_fn = t.pq_fn || {},
            o[e] = l,
            l
        },
        selectRange: function(t, e) {
            var r, n, i, o, a = cFormulas.selectExp(t, e);
            return a ? (/^([a-z0-9]+):([a-z0-9]+)$/i.test(a) ? (r = a.split(":"), n = this.toCell(r[0]), i = this.toCell(r[1]), o = {
                r1: n.r,
                c1: n.c,
                r2: i.r,
                c2: i.c
            }) : /^[a-z]+[0-9]+$/i.test(a) && (n = this.toCell(a), o = {
                r1: n.r,
                c1: n.c
            }), o) : void 0
        },
        select: function(t, e) {
            var r = this.selectRange(t, e),
            n = this.that;
            r ? n.Range(r).select() : n.Selection().removeAll()
        },
        toCell: function(t) {
            var e = t.match(/\$?([A-Z]+)?\$?(\d+)?/);
            return {
                c: e[1] ? pq.toNumber(e[1]) : null,
                r: e[2] ? e[2] - 1 : null
            }
        },
        valueArr: function(t, e, r, n) {
            var i, o, a, l, s, d, c = this.that,
            u = c.colModel,
            h = u.length,
            f = [],
            p = [],
            g = [],
            v = c.get_p_data(),
            m = v.length;
            for (r = null == r ? t: r, n = null == n ? e: n, t = 0 > t ? 0 : t, e = 0 > e ? 0 : e, r = r >= m ? m - 1 : r, n = n >= h ? h - 1 : n, i = t; r >= i; i++) {
                for (a = v[i], o = e; n >= o; o++) l = u[o].dataIndx,
                d = (s = this.getFnW(a, l)) ? this.execIfDirty(s) : a[l],
                f.push(d),
                g.push(d);
                p.push(g),
                g = []
            }
            return f.get2Arr = function() {
                return p
            },
            f.getRange = function() {
                return {
                    r1: t,
                    c1: e,
                    r2: r,
                    c2: n
                }
            },
            f
        }
    }
} (jQuery),
function(t) {
    var e = window.pq = window.pq || {};
    e.intel = {
        removeFn: function(t) {
            var e, r = t.length;
            return t = t.replace(/[a-z]*\([^()]*\)/gi, ""),
            e = t.length,
            r === e ? t: this.removeFn(t)
        },
        removeStrings: function(t) {
            return t = t.replace(/"[^"]*"/g, ""),
            t.replace(/"[^"]*$/, "")
        },
        getMatch: function(t, r) {
            var n, i = e.formulas,
            o = [];
            t = t.toUpperCase();
            for (n in i) if (r) {
                if (n === t) return [n]
            } else 0 === n.indexOf(t) && o.push(n);
            return o
        },
        intel: function(t) {
            t = this.removeStrings(t),
            t = this.removeFn(t);
            var e, r, n, i = /^=(.*[,+\-&*\s(><=])?([a-z]+)((\()[^)]*)?$/i;
            return (e = t.match(i)) && (r = e[2], e[4] && (n = !0)),
            [r, n]
        },
        movepos: function(t) {
            var e;
            return (e = t.match(/([^a-z].*)/i)) ? t.indexOf(e[1]) + 1 : t.length
        },
        intel3: function(t, e) {
            e < t.length && /=(.*[,+\-&*\s(><=])?[a-z]+$/i.test(t.slice(0, e)) && (e += this.movepos(t.slice(e)));
            var r = t.substr(0, e),
            n = this.intel(r);
            return n
        },
        item: function(t) {
            var e = this.that.options.strFormulas;
            return e = e ? e[t] : null,
            "<div>" + (e ? e[0] : t) + "</div>" + (e ? "<div style='font-size:0.9em;color:#888;margin-bottom:5px;'>" + e[1] + "</div>": "")
        },
        popup: function(e, r, n) {
            var i, o, a, l = n.closest(".pq-grid"),
            s = t(".pq-intel"),
            d = l,
            c = this.intel3(e, r);
            this.that = l.pqGrid("instance"),
            s.remove(),
            (i = c[0]) && (o = this.getMatch(i, c[1]), a = o.map(this.item, this).join(""), a && t("<div class='pq-intel' style='width:350px;max-height:300px;overflow:auto;background:#fff;border:1px solid gray;box-shadow: 4px 4px 2px #aaaaaa;padding:5px;'></div>").appendTo(d).html(a).position({
                my: "center top",
                at: "center bottom",
                collision: "flipfit",
                of: n,
                within: d
            }))
        },
        hide: function() {
            t(".pq-intel").remove()
        }
    }
} (jQuery),
function($) {
    var f = pq.formulas = {
        evalify: function(t, e) {
            var r, n, i = e.match(/([><=]{1,2})?(.*)/),
            o = i[1] || "=",
            a = i[2],
            l = this;
            return /(\*|\?)/.test(a) ? r = a.replace(/\*/g, ".*").replace(/\?/g, "\\S").replace(/\(/g, "\\(").replace(/\)/g, "\\)") : (o = "=" === o ? "==": "<>" === o ? "!=": o, n = this.isNumber(a)),
            t.map(function(t) {
                return r ? (t = null == t ? "": t, t = ("<>" === o ? "!": "") + "/^" + r + '$/i.test("' + t + '")') : n ? t = l.isNumber(t) ? t + o + a: "false": (t = null == t ? "": t, t = '"' + (t + "").toUpperCase() + '"' + o + '"' + (a + "").toUpperCase() + '"'),
                t
            })
        },
        get2Arr: function(t) {
            return t.get2Arr ? t.get2Arr() : t
        },
        isNumber: function(t) {
            return parseFloat(t) == t
        },
        _reduce: function(t, e) {
            var r = (t.length, []),
            n = e.map(function(t) {
                return []
            });
            return t.forEach(function(t, i) {
                null != t && (t = 1 * t, isNaN(t) || (r.push(t), n.forEach(function(t, r) {
                    t.push(e[r][i])
                })))
            }),
            [r, n]
        },
        reduce: function(t) {
            t = this.toArray(t);
            var e = t.shift(),
            r = t.filter(function(t, e) {
                return e % 2 == 0
            }),
            n = this._reduce(e, r);
            return e = n[0],
            r = n[1],
            [e].concat(t.map(function(e, n) {
                return n % 2 == 0 ? r[n / 2] : t[n]
            }))
        },
        strDate1: "(\\d{1,2})/(\\d{1,2})/(\\d{2,4})",
        strDate2: "(\\d{4})-(\\d{1,2})-(\\d{1,2})",
        strTime: "(\\d{1,2})(:(\\d{1,2}))?(:(\\d{1,2}))?(\\s(AM|PM))?",
        isDate: function(t) {
            return this.reDate.test(t) && Date.parse(t) || t && t.constructor == Date
        },
        toArray: function(t) {
            for (var e = [], r = 0, n = t.length; n > r; r++) e.push(t[r]);
            return e
        },
        valueToDate: function(t) {
            var e = new Date(Date.UTC(1900, 0, 1));
            return e.setUTCDate(e.getUTCDate() + t - 2),
            e
        },
        varToDate: function(t) {
            var e, r, n, i, o;
            if (this.isNumber(t)) e = this.valueToDate(t);
            else if (t.getTime) e = t;
            else if ("string" == typeof t) {
                if ((r = t.match(this.reDateTime)) ? r[12] ? (o = 1 * r[13], i = 1 * r[15], n = 1 * r[14]) : (n = 1 * r[2], i = 1 * r[3], o = 1 * r[4]) : (r = t.match(this.reDate2)) ? (o = 1 * r[1], i = 1 * r[3], n = 1 * r[2]) : (r = t.match(this.reDate1)) && (n = 1 * r[1], i = 1 * r[2], o = 1 * r[3]), !r) throw "#N/A date";
                t = Date.UTC(o, n - 1, i),
                e = new Date(t)
            }
            return e
        },
        _IFS: function(arg, fn) {
            for (var len = arg.length,
            i = 0,
            arr = [], a = 0; len > i; i += 2) arr.push(this.evalify(arg[i], arg[i + 1]));
            for (var condsIndx = arr[0].length, lenArr = len / 2, j; condsIndx--;) {
                for (j = 0; lenArr > j && eval(arr[j][condsIndx]); j++);
                a += j === lenArr ? fn(condsIndx) : 0
            }
            return a
        },
        ABS: function(t) {
            return Math.abs(t.map ? t[0] : t)
        },
        ACOS: function(t) {
            return Math.acos(t)
        },
        AND: function() {
            var arr = this.toArray(arguments);
            return eval(arr.join(" && "))
        },
        ASIN: function(t) {
            return Math.asin(t)
        },
        ATAN: function(t) {
            return Math.atan(t)
        },
        _AVERAGE: function(t) {
            var e = 0,
            r = 0;
            if (t.forEach(function(t) {
                parseFloat(t) == t && (r += 1 * t, e++)
            }), e) return r / e;
            throw "#DIV/0!"
        },
        AVERAGE: function() {
            return this._AVERAGE(pq.flatten(arguments))
        },
        AVERAGEIF: function(t, e, r) {
            return this.AVERAGEIFS(r || t, t, e)
        },
        AVERAGEIFS: function() {
            var t = this.reduce(arguments),
            e = 0,
            r = t.shift(),
            n = this._IFS(t,
            function(t) {
                return e++,
                r[t]
            });
            if (!e) throw "#DIV/0!";
            return n / e
        },
        TRUE: !0,
        FALSE: !1,
        CEILING: function(t) {
            return Math.ceil(t)
        },
        CHAR: function(t) {
            return String.fromCharCode(t)
        },
        CHOOSE: function() {
            var t = pq.flatten(arguments),
            e = t[0];
            if (e > 0 && e < t.length) return t[e];
            throw "#VALUE!"
        },
        CODE: function(t) {
            return (t + "").charCodeAt(0)
        },
        COLUMN: function(t) {
            return (t || this).getRange().c1 + 1
        },
        COLUMNS: function(t) {
            var e = t.getRange();
            return e.c2 - e.c1 + 1
        },
        CONCATENATE: function() {
            var t = pq.flatten(arguments),
            e = "";
            return t.forEach(function(t) {
                e += t
            }),
            e
        },
        COS: function(t) {
            return Math.cos(t)
        },
        _COUNT: function(t) {
            var e = pq.flatten(t),
            r = this,
            n = 0,
            i = 0,
            o = 0;
            return e.forEach(function(t) {
                null == t || "" === t ? n++:(i++, r.isNumber(t) && o++)
            }),
            [n, i, o]
        },
        COUNT: function() {
            return this._COUNT(arguments)[2]
        },
        COUNTA: function() {
            return this._COUNT(arguments)[1]
        },
        COUNTBLANK: function() {
            return this._COUNT(arguments)[0]
        },
        COUNTIF: function(t, e) {
            return this.COUNTIFS(t, e)
        },
        COUNTIFS: function() {
            return this._IFS(arguments,
            function() {
                return 1
            })
        },
        DATE: function(t, e, r) {
            if (0 > t || t > 9999) throw "#NUM!";
            return 1899 >= t && (t += 1900),
            this.VALUE(new Date(Date.UTC(t, e - 1, r)))
        },
        DATEVALUE: function(t) {
            return this.DATEDIF("1/1/1900", t, "D") + 2
        },
        DATEDIF: function(t, e, r) {
            var n, i = this.varToDate(e),
            o = this.varToDate(t),
            a = i.getTime(),
            l = o.getTime(),
            s = (a - l) / 864e5;
            if ("Y" === r) return parseInt(s / 365);
            if ("M" === r) return n = i.getUTCMonth() - o.getUTCMonth() + 12 * (i.getUTCFullYear() - o.getUTCFullYear()),
            o.getUTCDate() > i.getUTCDate() && n--,
            n;
            if ("D" === r) return s;
            throw "unit N/A"
        },
        DAY: function(t) {
            return this.varToDate(t).getUTCDate()
        },
        DAYS: function(t, e) {
            return this.DATEDIF(e, t, "D")
        },
        DEGREES: function(t) {
            return 180 / Math.PI * t
        },
        EOMONTH: function(t, e) {
            e = e || 0;
            var r = this.varToDate(t);
            return r.setUTCMonth(r.getUTCMonth() + e + 1),
            r.setUTCDate(0),
            this.VALUE(r)
        },
        EXP: function(t) {
            return Math.exp(t)
        },
        FIND: function(t, e, r) {
            return e.indexOf(t, r ? r - 1 : 0) + 1
        },
        FLOOR: function(t, e) {
            return 0 > t * e ? "#NUM!": parseInt(t / e) * e
        },
        HLOOKUP: function(t, e, r, n) {
            null == n && (n = !0),
            e = this.get2Arr(e);
            var i = this.MATCH(t, e[0], n ? 1 : 0);
            return this.INDEX(e, r, i)
        },
        HOUR: function(t) {
            if (Date.parse(t)) {
                var e = new Date(t);
                return e.getHours()
            }
            return 24 * t
        },
        IF: function(t, e, r) {
            return t ? e: r
        },
        INDEX: function(t, e, r) {
            return t = this.get2Arr(t),
            e = e || 1,
            r = r || 1,
            "function" == typeof t[0].push ? t[e - 1][r - 1] : t[e > 1 ? e - 1 : r - 1]
        },
        INDIRECT: function(t) {
            var e = this.iFormula;
            return e.cell(t.toUpperCase())
        },
        LARGE: function(t, e) {
            return t.sort(),
            t[t.length - (e || 1)]
        },
        LEFT: function(t, e) {
            return t.substr(0, e || 1)
        },
        LEN: function(t) {
            return t = (t.map ? t: [t]).map(function(t) {
                return t.length
            }),
            t.length > 1 ? t: t[0]
        },
        LOOKUP: function(t, e, r) {
            r = r || e;
            var n = this.MATCH(t, e, 1);
            return this.INDEX(r, 1, n)
        },
        LOWER: function(t) {
            return (t + "").toLocaleLowerCase()
        },
        _MAXMIN: function(t, e) {
            var r, n = this;
            return t.forEach(function(t) {
                null != t && (t = n.VALUE(t), n.isNumber(t) && (t * e > r * e || null == r) && (r = t))
            }),
            null != r ? r: 0
        },
        MATCH: function(val, arr, type) {
            var isNumber = this.isNumber(val),
            _isNumber,
            sign,
            indx,
            _val,
            i = 0,
            len = arr.length;
            if (null == type && (type = 1), val = isNumber ? val: val.toUpperCase(), 0 === type) {
                for (arr = this.evalify(arr, val + ""), i = 0; len > i; i++) if (_val = arr[i], eval(_val)) {
                    indx = i + 1;
                    break
                }
            } else {
                for (i = 0; len > i; i++) if (_val = arr[i], _isNumber = this.isNumber(_val), _val = arr[i] = _isNumber ? _val: _val ? _val.toUpperCase() : "", val == _val) {
                    indx = i + 1;
                    break
                }
                if (!indx) {
                    for (i = 0; len > i; i++) if (_val = arr[i], _isNumber = this.isNumber(_val), type * (val > _val ? -1 : 1) === 1 && isNumber == _isNumber) {
                        indx = i;
                        break
                    }
                    indx = null == indx ? i: indx
                }
            }
            if (indx) return indx;
            throw "#N/A"
        },
        MAX: function() {
            var t = pq.flatten(arguments);
            return this._MAXMIN(t, 1)
        },
        MEDIAN: function() {
            var t = pq.flatten(arguments).filter(function(t) {
                return 1 * t == t
            }).sort(function(t, e) {
                return e - t
            }),
            e = t.length,
            r = e / 2;
            return r === parseInt(r) ? (t[r - 1] + t[r]) / 2 : t[(e - 1) / 2]
        },
        MID: function(t, e, r) {
            if (1 > e || 0 > r) throw "#VALUE!";
            return t.substr(e - 1, r)
        },
        MIN: function() {
            var t = pq.flatten(arguments);
            return this._MAXMIN(t, -1)
        },
        MODE: function() {
            var t, e, r = pq.flatten(arguments),
            n = {},
            i = 0;
            if (r.forEach(function(r) {
                t = n[r] = n[r] ? n[r] + 1 : 1,
                t > i && (i = t, e = r)
            }), 2 > i) throw "#N/A";
            return e
        },
        MONTH: function(t) {
            return this.varToDate(t).getUTCMonth() + 1
        },
        OR: function() {
            var arr = this.toArray(arguments);
            return eval(arr.join(" || "))
        },
        PI: function() {
            return Math.PI
        },
        POWER: function(t, e) {
            return Math.pow(t, e)
        },
        PRODUCT: function() {
            var t = pq.flatten(arguments),
            e = 1;
            return t.forEach(function(t) {
                e *= t
            }),
            e
        },
        PROPER: function(t) {
            return t = t.replace(/(\S+)/g,
            function(t) {
                return t.charAt(0).toUpperCase() + t.substr(1).toLowerCase()
            })
        },
        RADIANS: function(t) {
            return Math.PI / 180 * t
        },
        RAND: function() {
            return Math.random()
        },
        RANK: function(t, e, r) {
            var n = JSON.stringify(e.getRange()),
            i = this,
            o = n + "_range";
            e = this[o] ||
            function() {
                return i[o] = e,
                e.sort(function(t, e) {
                    return t - e
                })
            } ();
            for (var a = 0,
            l = e.length; l > a; a++) if (t === e[a]) return r ? a + 1 : l - a
        },
        RATE: function() {},
        REPLACE: function(t, e, r, n) {
            return t += "",
            t.substr(0, e - 1) + n + t.substr(e + r - 1)
        },
        REPT: function(t, e) {
            for (var r = ""; e--;) r += t;
            return r
        },
        RIGHT: function(t, e) {
            return e = e || 1,
            t.substr( - 1 * e, e)
        },
        _ROUND: function(t, e, r) {
            var n = Math.pow(10, e),
            i = t * n,
            o = parseInt(i),
            a = i - o;
            return r(o, a) / n
        },
        ROUND: function(t, e) {
            return this._ROUND(t, e,
            function(t, e) {
                var r = Math.abs(e);
                return t + (r >= .5 ? r / e: 0)
            })
        },
        ROUNDDOWN: function(t, e) {
            return this._ROUND(t, e,
            function(t) {
                return t
            })
        },
        ROUNDUP: function(t, e) {
            return this._ROUND(t, e,
            function(t, e) {
                return t + (e ? Math.abs(e) / e: 0)
            })
        },
        ROW: function(t) {
            return (t || this).getRange().r1 + 1
        },
        ROWS: function(t) {
            var e = t.getRange();
            return e.r2 - e.r1 + 1
        },
        SEARCH: function(t, e, r) {
            return t = t.toUpperCase(),
            e = e.toUpperCase(),
            e.indexOf(t, r ? r - 1 : 0) + 1
        },
        SIN: function(t) {
            return Math.sin(t)
        },
        SMALL: function(t, e) {
            return t.sort(),
            t[(e || 1) - 1]
        },
        SQRT: function(t) {
            return Math.sqrt(t)
        },
        _STDEV: function(t) {
            t = pq.flatten(t);
            var e = t.length,
            r = this._AVERAGE(t),
            n = 0;
            return t.forEach(function(t) {
                n += (t - r) * (t - r)
            }),
            [n, e]
        },
        STDEV: function() {
            var t = this._STDEV(arguments);
            if (1 === t[1]) throw "#DIV/0!";
            return Math.sqrt(t[0] / (t[1] - 1))
        },
        STDEVP: function() {
            var t = this._STDEV(arguments);
            return Math.sqrt(t[0] / t[1])
        },
        SUBSTITUTE: function(t, e, r, n) {
            var i = 0;
            return t.replace(new RegExp(e, "g"),
            function(t) {
                return i++,
                n ? i === n ? r: e: r
            })
        },
        SUM: function() {
            var t = pq.flatten(arguments),
            e = 0,
            r = this;
            return t.forEach(function(t) {
                t = r.VALUE(t),
                r.isNumber(t) && (e += parseFloat(t))
            }),
            e
        },
        SUMIF: function(t, e, r) {
            return this.SUMIFS(r || t, t, e)
        },
        SUMIFS: function() {
            var t = this.reduce(arguments),
            e = t.shift();
            return this._IFS(t,
            function(t) {
                return e[t]
            })
        },
        SUMPRODUCT: function() {
            var t = this.toArray(arguments);
            return t = t[0].map(function(e, r) {
                var n = 1;
                return t.forEach(function(t) {
                    var e = t[r];
                    n *= parseFloat(e) == e ? e: 0
                }),
                n
            }),
            pq.aggregate.sum(t)
        },
        TAN: function(t) {
            return Math.tan(t)
        },
        TEXT: function(t, e) {
            return this.isNumber(t) && e.indexOf("#") >= 0 ? pq.formatNumber(t, e) : $.datepicker.formatDate(pq.excelToJui(e), this.varToDate(t))
        },
        TIME: function(t, e, r) {
            return (t + e / 60 + r / 3600) / 24
        },
        TIMEVALUE: function(t) {
            var e = t.match(this.reTime);
            if (e && null != e[1] && (null != e[3] || null != e[7])) var r = 1 * e[1],
            n = 1 * (e[3] || 0),
            i = 1 * (e[5] || 0),
            o = (e[7] || "").toUpperCase(),
            a = r + n / 60 + i / 3600;
            if (a >= 0 && (o && 13 > a || !o && 24 > a)) return "PM" == o && 12 > r ? a += 12 : "AM" == o && 12 == r && (a -= 12),
            a / 24;
            throw "#VALUE!"
        },
        TODAY: function() {
            var t = new Date;
            return this.VALUE(new Date(Date.UTC(t.getFullYear(), t.getMonth(), t.getDate())))
        },
        TRIM: function(t) {
            return t.replace(/^\s+|\s+$/gm, "")
        },
        TRUNC: function(t, e) {
            return e = Math.pow(10, e || 0),
            ~~ (t * e) / e
        },
        UPPER: function(t) {
            return (t + "").toLocaleUpperCase()
        },
        VALUE: function(t) {
            var e, r;
            if (t) if (parseFloat(t) == t) r = parseFloat(t);
            else if (this.isDate(t)) r = this.DATEVALUE(t);
            else if (e = t.match(this.reDateTime)) {
                var n = e[1] || e[12],
                i = t.substr(n.length + 1);
                r = this.DATEVALUE(n) + this.TIMEVALUE(i)
            } else(e = t.match(this.reTime)) ? r = this.TIMEVALUE(t) : (r = t.replace(/[^0-9\-.]/g, ""), r = r.replace(/(\.[1-9]*)0+$/, "$1").replace(/\.$/, ""));
            else r = 0;
            return r
        },
        VAR: function() {
            var t = this._STDEV(arguments);
            return t[0] / (t[1] - 1)
        },
        VARP: function() {
            var t = this._STDEV(arguments);
            return t[0] / t[1]
        },
        VLOOKUP: function(t, e, r, n) {
            null == n && (n = !0),
            e = this.get2Arr(e);
            var i = e.map(function(t) {
                return t[0]
            }),
            o = this.MATCH(t, i, n ? 1 : 0);
            return this.INDEX(e, o, r)
        },
        YEAR: function(t) {
            return this.varToDate(t).getUTCFullYear()
        }
    };
    f.reDate1 = new RegExp("^" + f.strDate1 + "$"),
    f.reDate2 = new RegExp("^" + f.strDate2 + "$"),
    f.reDate = new RegExp("^" + f.strDate1 + "$|^" + f.strDate2 + "$"),
    f.reTime = new RegExp("^" + f.strTime + "$", "i"),
    f.reDateTime = new RegExp("^(" + f.strDate1 + ")\\s" + f.strTime + "$|^(" + f.strDate2 + ")\\s" + f.strTime + "$")
} (jQuery),
function(t) {
    var e = t.paramquery;
    t(document).on("pqGrid:bootup",
    function(t, r) {
        var n = r.instance;
        new e.cEditor(n)
    }),
    e.cEditor = function(t) {
        var e = this;
        e.that = t,
        t.on("editorBeginDone",
        function(t, r) {
            r.$td[0].edited = !0,
            e.fixWidth(r),
            setTimeout(function() {
                document.body.contains(r.$editor[0]) && e.fixWidth(r)
            })
        }).on("editorEnd",
        function(t, r) {
            r.$td[0].edited = !1,
            cancelAnimationFrame(e.id)
        }).on("editorKeyDown",
        function(t, r) {
            e.id = requestAnimationFrame(function() {
                e.fixWidth(r)
            })
        })
    },
    e.cEditor.prototype = {
        escape: function(t) {
            return t = t.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/</g, "&lt;"),
            t.replace(/(\n)$/, "$1A")
        },
        fixWidth: function(e) {
            var r, n = this,
            i = n.that,
            o = e.$td,
            a = o[0],
            l = a.offsetWidth,
            s = a.offsetHeight,
            d = i.widget(),
            c = e.$editor,
            u = c[0].type;
            if ("text" == u || "textarea" == u) {
                var h = n.escape(c.val()),
                f = d.width(),
                p = t("<span style='position:absolute;top:0;left:0;visibilty:hidden;'><pre>" + h + "</pre></span>").appendTo(d),
                g = parseInt(p.width()) + 25;
                if (p.remove(), g = g > f ? f: g > l ? g: l, "textarea" == u) {
                    var v = c.clone().appendTo(d),
                    m = v[0];
                    v.css({
                        height: 18,
                        width: g,
                        position: "absolute",
                        left: 0,
                        top: 0,
                        overflow: "hidden"
                    }),
                    r = m.scrollHeight + 5,
                    v.remove(),
                    c.css({
                        height: r,
                        width: g,
                        resize: "none",
                        overflow: "hidden"
                    })
                }
            } else g = l,
            r = s;
            c.css("width", g + "px"),
            n.position(c, d, o)
        },
        position: function(t, e, r) {
            t.closest(".pq-editor-outer").css("border-width", "0").position({
                my: "left center",
                at: "left center",
                of: r,
                collision: "fit",
                within: e
            })
        }
    }
} (jQuery),
function(t) {
    var e = window.pq,
    r = e.cVirtual = function() {
        this.diffH = 0,
        this.diffV = 0
    };
    r.setSBDim = function() {
        var e = t("<div style='max-width:100px;height:100px;position:fixed;left:0;top:0;overflow:auto;visibility:hidden;'><div style='width:200px;height:100px;'></div></div>").appendTo(document.body),
        r = e[0];
        this.SBDIM = r.offsetHeight - r.clientHeight,
        e.remove()
    },
    r.prototype = {
        assignTblDims: function(t) {
            var e, r = this,
            n = r.isBody(),
            i = !0,
            o = r.getTopSafe(this[t ? "cols": "rows"], t, i),
            a = r.maxHt;
            o > a ? (r[t ? "ratioH": "ratioV"] = o / a, r[t ? "virtualWd": "virtualHt"] = o, o = a) : (o = o || (r.isHead() ? 0 : 1), r[t ? "ratioH": "ratioV"] = 1);
            var l = r.$tbl_right[0],
            s = r[t ? "$tbl_tr": "$tbl_left"],
            d = s.length ? s[0] : {
                style: {}
            },
            c = t ? "width": "height";
            l.style[c] = o + "px",
            d.style[c] = o + "px",
            n ? e = "Tbl": r.isHead() ? (e = "TblHead", t && r.$spacer.css("left", o)) : e = "TblSum",
            r.dims[t ? "wd" + e: "ht" + e] = o,
            n && r.triggerTblDims(100)
        },
        calInitFinal: function(t, e, r) {
            var n, i, o, a = this[r ? "cols": "rows"],
            l = this[r ? "freezeCols": "freezeRows"],
            s = this[r ? "leftArr": "topArr"],
            d = this.getTopSafe(l, r);
            if (r && (d -= this.numColWd), t += d, e += d, a > l && s[l] < t) {
                for (var c, u = 30,
                h = a; u--;) if (c = Math.floor((l + h) / 2), s[c] >= t) h = c;
                else {
                    if (l == c) {
                        o = !0;
                        break
                    }
                    l = c
                }
                if (!o) throw "ri not found"
            }
            for (; a >= l; l++) if (s[l] > t) {
                n = l ? l - 1 : l;
                break
            }
            for (; a >= l; l++) if (s[l] > e) {
                i = l - 1;
                break
            }
            return null == n && null == i && a && t > s[a - 1] ? [null, null] : (null == n && (n = 0), null == i && (i = a - 1), [n, i])
        },
        calInitFinalSuper: function() {
            var t = this,
            e = this.dims || {},
            r = t.calcTopBottom(),
            n = r[0],
            i = r[1],
            o = r[2],
            a = t.calcTopBottom(!0),
            l = a[0],
            s = a[1],
            d = t.calInitFinal(n, i),
            c = d[0],
            u = d[1],
            h = t.calInitFinal(l, s, !0),
            f = h[0],
            p = h[1];
            return this.isBody() && (e.bottom = i, e.top = n, e.left = l, e.right = s),
            o = o || a[2],
            [c, f, u, p, o]
        },
        calcTopBottom: function(t) {
            var e, n, i = this,
            o = i.isBody(),
            a = i.dims,
            l = i.$cright[0];
            if (t) var s = l.scrollLeft,
            d = i.sleft,
            c = a.wdCont,
            u = i.wdContLeft,
            h = i.ratioH;
            else s = l.scrollTop,
            d = i.stop,
            c = i.htCont,
            u = i.htContTop,
            h = i.ratioV;
            if (1 == h) return n = s + c - u,
            n >= 0 || (n = 0),
            [s, n];
            var f, p, g, v = r.maxHt,
            m = i[t ? "virtualWd": "virtualHt"],
            w = t ? a.wdContClient: a.htContClient,
            x = t ? "diffH": "diffV",
            y = i[x],
            C = c - w;
            if (s + w >= v ? (n = m - u + C, e = n - c + u) : (0 == s ? e = 0 : (f = null == d || Math.abs(s - d) > c ? h: 1, e = s * f + (1 == f && y ? y: 0)), n = e + c - u), p = e - s, p != y && (g = !0, i[x] = p, o && i.triggerTblDims(3e3)), i[t ? "sleft": "stop"] = s, !(s >= 0)) throw "stop NaN";
            if (! (n >= 0 && e >= 0)) throw "top bottom NaN";
            return [e, n, g]
        },
        getHtDetail: function(t, e) {
            var r = t.pq_detail;
            return r && r.show ? r.height || e: 0
        },
        getTop: function(t, e) {
            var r = this.topArr[t],
            n = e ? 0 : this.diffV;
            if (n && (r -= t > this.freezeRows ? n: 0, 0 > r && (r = 0)), r >= 0) return r;
            throw r
        },
        getTopSafe: function(t, e, r) {
            var n = e ? this.cols: this.rows;
            return this[e ? "getLeft": "getTop"](t > n ? n: t, r)
        },
        getLeft: function(t, e) {
            var r = this.numColWd,
            n = -1 == t ? 0 : this.leftArr[t] + r,
            i = e ? 0 : this.diffH;
            if (i && (n -= t > this.freezeCols ? i: 0, 0 > n && (n = 0)), n >= 0) return n;
            throw n
        },
        getHeightR: function(t, e) {
            e = e || 1;
            var r = this.topArr,
            n = r[t + e] - r[t];
            if (n >= 0) return n;
            throw n
        },
        getHeightCell: function(t, e) {
            e = e || 1;
            var r, n, i = this.topArr,
            o = this.rowHtDetail;
            if (r = o ? this.getHtDetail(this.data[t + e - 1], o) : 0, n = i[t + e] - i[t] - r, n >= 0) return n;
            throw n
        },
        getHeightCellM: function(t, e) {
            return this.getTopSafe(t + e) - this.getTop(t) - 1.5
        },
        getHeightCellDirty: function(t, e) {
            return this.setTopArr(t, null, t + e),
            this.getHeightCellM(t, e)
        },
        getWidthCell: function(t) {
            if ( - 1 == t) return this.numColWd;
            var e = this.colwdArr[t];
            if (e >= 0) return e;
            throw e
        },
        getWidthCellM: function(t, e) {
            return this.getTopSafe(t + e, !0) - this.getLeft(t)
        },
        initRowHtArr: function() {
            var t, e = this.rowHt,
            r = this.data,
            n = r.length,
            i = this.rowHtDetail,
            o = this.rowhtArr = [],
            a = (this.topArr = [], 0);
            if (i) for (; n > a; a++) t = r[a],
            o[a] = t.pq_hidden ? 0 : t.pq_ht || e + this.getHtDetail(t, i);
            else for (; n > a; a++) t = r[a],
            o[a] = t.pq_hidden ? 0 : t.pq_ht || e
        },
        initRowHtArrDetailSuper: function(t) {
            var e, r = this.rowhtArr,
            n = this.data;
            t.forEach(function(t) {
                e = t[0],
                r[e] = n[e].pq_ht = r[e] + t[1]
            }),
            this.setTopArr(),
            this.assignTblDims()
        },
        initRowHtArrSuper: function() {
            this.initRowHtArr(),
            this.setTopArr(),
            this.assignTblDims()
        },
        refreshRowHtArr: function(t, e) {
            var r = this.data[t],
            n = this.rowHtDetail,
            i = this.rowHt;
            this.rowhtArr[t] = r.pq_hidden ? 0 : i + this.getHtDetail(r, n),
            e && (this.setTopArr(t), this.assignTblDims())
        },
        setTopArr: function(t, e, r) {
            var n, i, o, a, l, s = t || 0,
            d = this;
            for (e ? (i = d.cols, a = d.colwdArr, l = d.leftArr) : (i = d.rows, a = d.rowhtArr, l = d.topArr), o = r && i > r ? r: i - 1, n = s ? l[s] : 0; o >= s; s++) l[s] = n,
            n += a[s];
            l[s] = n,
            l.length = i + 1
        },
        triggerTblDims: function(t) {
            var e = this;
            e.setTimer(function() {
                e.that._trigger("assignTblDims")
            },
            "assignTblDims", t)
        }
    }
} (jQuery),
function(t) {
    var e = 1533910;
    t(function() {
        var r = t("<div style='position:relative;'></div>").appendTo(document.body),
        n = t("<div style='position:absolute;left:0;'></div>").appendTo(r)[0],
        i = 1e9,
        o = pq.cVirtual;
        n.style.top = i + "px";
        var a = n.offsetTop - 50;
        e = 1e4 >= a ? e: a,
        e > 16554378 && (e = 16554378),
        o.maxHt = e,
        r.remove(),
        o.setSBDim(),
        t(window).on("resize", o.setSBDim.bind(o))
    })
} (jQuery),
function(t) {
    var e = window.pq = window.pq || {};
    e.cRender = function() {},
    e.cRender.prototype = t.extend({},
    {
        _m: function() {},
        autoHeight: function(t) {
            var e = this,
            r = e.isBody(),
            n = t.hChanged,
            i = e.freezeRows,
            o = !1,
            a = e.initV,
            l = e.finalV;
            e.rows && (o = e.setRowHtArr(a, l, n), o = e.setRowHtArr(0, i - 1, n) || o, o ? (e.setTopArr(i ? 0 : a), e.assignTblDims(), e.setPanes(), e.setCellDims(!0), r && (t.source = "autoRow", e.refresh(t), e.that._trigger("autoRowHeight"))) : e.setCellDims(!0))
        },
        autoWidth: function(t) {
            var e = this,
            r = e.freezeCols,
            n = e.initH,
            i = e.finalH;
            null == t ? (e.setColWdArr(n, i), e.setColWdArr(0, r - 1)) : e.setColWdArr(t, t)
        },
        generateCell: function(t, e, r, n, i, o) {
            var a, l, s, d, c, u, h, f, p = this.iMerge,
            g = [],
            v = this.riOffset,
            m = t + v,
            w = [this.cellCls];
            if (this._m() && (f = p.ismergedCell(m, e))) {
                if (!f.o_rc) return t == this._initV || e == this._initH ? (c = this.getCellRegion(t, e), d = p.getRootCell(m, e), l = d.v_ri - v, s = d.v_ci, 0 > l ? "": (u = this.getCellRegion(l, s), this.mcLaid[l + "," + s + (u == c ? "": "," + c)] = !0, "")) : "";
                d = p.getClsStyle(m, e),
                d.style && g.push(d.style),
                d.cls && w.push(d.cls),
                m = f.o_ri,
                t = m - v,
                r = this.data[t],
                e = f.o_ci,
                n = this.colModel[e],
                o = this.getHeightCellM(t, f.o_rc),
                a = this.getWidthCellM(e, f.o_cc),
                w.push("pq-merge-cell")
            } else if (r.pq_hidden || n.hidden) return "";
            if (h = this.getCellId(t, e, i), this.getById(h)) return "";
            var x = o || this.getHeightCell(t),
            y = a || this.colwdArr[e],
            C = this.getLeft(e);
            return g.push("left:" + C + "px;width:" + y + "px;height:" + x + "px;"),
            this.renderCell({
                style: g,
                cls: w,
                attr: ["role='gridcell' id='" + h + "'"],
                rowData: r,
                rowIndxPage: t,
                rowIndx: m,
                colIndx: e,
                column: n
            })
        },
        generateRow: function(t, e) {
            var r = "pq-grid-row",
            n = "top:" + this.getTop(t) + "px;height:" + this.getHeightR(t) + "px;width:100%;",
            i = this.getRowId(t, e),
            o = "role='row' id='" + i + "'",
            a = this.getRowClsStyleAttr(t);
            return r += " " + a[0],
            n += a[1],
            o += " " + a[2],
            "<div class='" + r + "' " + o + " style='" + n + "'>"
        },
        getById: function(t) {
            return document.getElementById(t)
        },
        getCell: function(t, e, r) {
            var n, i, o = this.riOffset,
            a = t + o;
            return r || (n = this.iMerge, n.ismergedCell(a, e) && (i = n.getRootCell(a, e), this.isHead() && (t = i.o_ri), r = this.getCellRegion(i.v_ri - o, i.v_ci))),
            this.getById(this.getCellId(t, e, r))
        },
        getCellIndx: function(t) {
            var e = t.id.split("-");
            return e[3] == "u" + this.uuid ? [1 * e[4], 1 * e[5], e[6]] : void 0
        },
        getCellId: function(t, e, r) {
            return t >= this.data.length ? "": (r = r || this.getCellRegion(t, e), this.cellPrefix + t + "-" + e + "-" + r)
        },
        getCellCont: function(t, e) {
            return this["$c" + this.getCellRegion(t, e)]
        },
        getCellCoords: function(t, e) {
            var r = this,
            n = r.maxHt,
            i = r.getTop(t),
            o = r.getHeightCell(t),
            a = i + o,
            a = a > n ? n: a,
            i = a - o,
            l = r.getLeft(e),
            s = r.getWidthCell(e),
            d = l + s,
            d = d > n ? n: d,
            l = d - s;
            return [l, i, d, a]
        },
        getCellRegion: function(t, e) {
            var r = this.freezeCols,
            n = this.freezeRows;
            return n > t ? r > e ? "lt": "tr": r > e ? "left": "right"
        },
        getCellXY: function(t, e) {
            var r = this.maxHt,
            n = Math.min(this.getLeft(e), r),
            i = Math.min(this.getTop(t), r);
            return [n, i]
        },
        getContRight: function() {
            return this.$cright
        },
        getMergeCells: function() {
            return this._m() ? this.$tbl.children().children(".pq-merge-cell") : t()
        },
        getRow: function(t, e) {
            return this.getById(this.getRowId(t, e))
        },
        get$Row: function(t) {
            return this.$ele.find("[id^=" + this.getRowId(t, "") + "]")
        },
        getRowClsStyleAttr: function(t) {
            var e = this.that,
            r = [],
            n = e.options,
            i = n.rowInit,
            o = this.data[t],
            a = o.pq_rowcls,
            l = o.pq_rowattr,
            s = "",
            d = "",
            c = t + this.riOffset;
            if (i) {
                var u = i.call(e, {
                    rowData: o,
                    rowIndxPage: t,
                    rowIndx: c
                });
                u && (u.cls && r.push(u.cls), s += u.attr ? " " + u.attr: "", d += u.style ? u.style: "")
            }
            if (n.stripeRows && this.stripeArr[t] && r.push("pq-striped"), o.pq_rowselect && r.push(e.iRows.hclass), a && r.push(a), l) {
                var h = e.stringifyAttr(l);
                for (var f in h) {
                    var p = h[f];
                    s += " " + f + '="' + p + '"'
                }
            }
            return [r.join(" "), d, s]
        },
        getRowId: function(t, e) {
            if (null == e) throw "getRowId region.";
            return this.rowPrefix + t + "-" + e
        },
        getRowIndx: function(t) {
            var e = t.id.split("-");
            return [1 * e[4], e[5]]
        },
        getTable: function(t, e) {
            return this["$tbl_" + this.getCellRegion(t, e)]
        },
        getFlexWidth: function() {
            return this._flexWidth
        },
        preInit: function(t) {
            var e = this,
            r = e.isBody(),
            n = e.isHead(),
            i = e.that,
            o = i.options,
            a = (o.freezeCols || 0, n ? 0 : o.freezeRows, "pq-table " + e.getTblCls(o)),
            l = ["pq-cont-inner ", "pq-cont-right", "pq-cont-left", "pq-cont-lt", "pq-cont-tr"];
            t.empty(),
            t[0].innerHTML = ['<div class="pq-grid-cont">', r ? '<div class="pq-grid-norows">' + o.strNoRows + "</div>": "", '<div class="', l[0] + l[1], '"><div class="pq-table-right ' + a + '"></div>', r ? "": '<div class="pq-r-spacer" style="position:absolute;top:0;height:10px;"></div>', "</div>", '<div class="' + l[0] + l[2] + '"><div class="pq-table-left ' + a + '"></div></div>', '<div class="' + l[0] + l[4] + '"><div class="pq-table-tr ' + a + '"></div></div>', '<div class="' + l[0] + l[3] + '"><div class="pq-table-lt ' + a + '"></div></div>', "</div>"].join(""),
            e.$cright = t.find("." + l[1]).on("scroll", e.onNativeScroll(e)),
            r || (e.$spacer = t.find(".pq-r-spacer")),
            e.$cleft = t.find("." + l[2]).on("scroll", e.onScrollL),
            e.$clt = t.find("." + l[3]).on("scroll", e.onScrollLT),
            e.$ctr = t.find("." + l[4]).on("scroll", e.onScrollT),
            e.$tbl = t.find(".pq-table").on("scroll", e.onScrollLT),
            e.$tbl_right = t.find(".pq-table-right"),
            e.$tbl_left = t.find(".pq-table-left"),
            e.$tbl_lt = t.find(".pq-table-lt"),
            e.$tbl_tr = t.find(".pq-table-tr"),
            r && e.$cleft.add(e.$ctr).on("mousewheel DOMMouseScroll", e.onMouseWheel(e))
        },
        isBody: function() {},
        isHead: function() {},
        isSum: function() {},
        jump: function(t, e, r) {
            return t > r && r >= e && (r = t),
            r
        },
        hasMergeCls: function(t) {
            return t && t.className.indexOf("pq-merge-cell") >= 0
        },
        initRefreshTimer: function(t) {
            var e = this;
            e.setTimer(e.onRefreshTimer(e, t), "refresh")
        },
        initStripeArr: function() {
            for (var t, e = this.rows,
            r = 0,
            n = this.stripeArr = [], i = this.data; e > r; r++) i[r].pq_hidden || (t = n[r] = !t)
        },
        isRenderedRow: function(t) {
            return !! this.getRow(t)
        },
        onScrollLT: function() {
            this.scrollTop = this.scrollLeft = 0
        },
        onScrollT: function() {
            this.scrollTop = 0
        },
        onScrollL: function() {
            this.scrollLeft = 0
        },
        refresh: function(t) {
            t = t || {};
            var e = this,
            r = e.that,
            n = e.isBody(),
            i = e.isHead(),
            o = (null == t.timer ? !0 : t.timer, e.mcLaid = {}),
            a = e.freezeCols,
            l = e.numColWd,
            s = !(!a && !l),
            d = e.freezeRows,
            c = e.calInitFinalSuper(),
            u = c[0],
            h = c[1],
            f = c[2],
            p = c[3],
            g = c[4],
            v = e.initV,
            m = e.finalV,
            w = e.initH,
            x = e.finalH;
            n && r.blurEditor({
                force: !0
            }),
            e._initV = u,
            e._finalV = f,
            e._initH = h,
            e._finalH = p,
            n && r._trigger("beforeTableView", null, {
                initV: u,
                finalV: f,
                pageData: e.data
            }),
            g || (null != m && f >= v && m >= u && (u > v ? (e.removeView(v, u - 1, w, x), s && e.removeView(v, u - 1, l ? -1 : 0, a - 1)) : v > u && (e.renderView(u, v - 1, h, p), s && e.renderView(u, v - 1, 0, a - 1)), m > f ? (e.removeView(f + 1, m, w, x), s && e.removeView(f + 1, m, l ? -1 : 0, a - 1)) : f > m && (e.renderView(m + 1, f, h, p), s && e.renderView(m + 1, f, 0, a - 1)), v = u, m = f), null != x && p > w && x > h && (h > w ? (e.removeView(v, m, w, h - 1), d && e.removeView(0, d - 1, w, h - 1)) : w > h && (e.renderView(v, m, h, w - 1), d && e.renderView(0, d - 1, h, w - 1)), x > p ? (e.removeView(v, m, p + 1, x), d && e.removeView(0, d - 1, p + 1, x)) : p > x && (e.renderView(v, m, x + 1, p), d && e.renderView(0, d - 1, x + 1, p)), w = h, x = p)),
            g || f !== m || u !== v || h !== w || p !== x ? (n && r._trigger("beforeViewEmpty", null, {
                region: "right"
            }), e.$tbl_right.empty(), e.renderView(u, f, h, p), !s || f === m && u === v || (e.$tbl_left.empty(), e.renderView(u, f, 0, a - 1)), d && (h === w && p === x || (r._trigger("beforeViewEmpty", null, {
                region: "tr"
            }), e.$tbl_tr.empty(), e.renderView(0, d - 1, h, p)), s && null == m && (e.$tbl_lt.empty(), e.renderView(0, d - 1, 0, a - 1)))) : e.removeMergeCells();
            for (var y in o) {
                var c = y.split(","),
                C = 1 * c[0],
                _ = 1 * c[1],
                I = c[2];
                e.renderView(C, C, _, _, I)
            }
            var b = h != e.initH || p != e.finalH,
            q = b && null != e.initH; (f != e.finalV || u != e.initV || b) && (n && b && e.createColDefs(h, p), e.initV = u, e.finalV = f, e.initH = h, e.finalH = p, n ? r._trigger("refresh", null, {
                source: t.source,
                hChanged: q
            }) : r._trigger(i ? "refreshHeader": "refreshSum", null, {
                hChanged: q
            }))
        },
        refreshAllCells: function(t) {
            var e = this;
            e.initH = e.initV = e.finalH = e.finalV = null,
            e.refresh(t)
        },
        refreshCell: function(e, r, n, i) {
            var o, a = this,
            l = a.isBody() && a._m() ? a.iMerge.getRootCellV(e + a.riOffset, r) : 0,
            s = e,
            d = r,
            c = function(l, s) {
                l && (o = !0, l.id = "", t(l).replaceWith(a.generateCell(e, r, n, i, s)))
            };
            return l ? (e = l.rowIndxPage, r = l.colIndx, n = l.rowData, i = l.column, ["lt", "tr", "left", "right"].forEach(function(t) {
                c(a.getCell(s, d, t), t)
            })) : c(a.getCell(e, r)),
            o
        },
        removeMergeCells: function() {
            for (var e, r, n, i, o, a, l, s, d, c, u = this,
            h = u.iMerge,
            f = u.riOffset,
            p = (u.freezeCols, u.freezeRows, u.getMergeCells()), g = u._initH, v = u._finalH, m = u._initV, w = u._finalV, x = 0, y = p.length; y > x; x++) s = p[x],
            r = u.getCellIndx(s),
            r && (n = r[0], i = r[1], d = r[2], e = h.getRootCell(n + f, i), o = n + e.o_rc - 1, a = i + e.o_cc - 1, l = !1, n > w || i > v ? l = !0 : "right" == d ? (m > o || g > a) && (l = !0) : "left" == d ? m > o && (l = !0) : "tr" == d && g > a && (l = !0), c = s.parentNode, l && t(s).remove(), c.children.length || c.parentNode.removeChild(c))
        },
        removeView: function(e, r, n, i) {
            var o, a, l, s, d = this.getCellRegion(e, n);
            for (a = e; r >= a; a++) if (o = this.getRow(a, d)) {
                for (l = n; i >= l; l++) s = this.getCell(a, l, d),
                s && (this.hasMergeCls(s) || t(s).remove());
                o.children.length || o.parentNode.removeChild(o)
            }
        },
        renderNumCell: function(t, e, r) {
            var n = this.getHeightR(t),
            i = this.getCellId(t, -1, r),
            o = "position:absolute;left:0;top:0;width:" + e + "px;height:" + n + "px;";
            return "<div id='" + i + "' style='" + o + "' role='gridcell' class='pq-grid-number-cell'>" + (this.isBody() ? t + 1 + this.riOffset: "") + "</div>"
        },
        renderRow: function(e, r, n, i, o, a) {
            var l, s, d, c, u = this.getRow(n, a),
            h = this.numColWd,
            f = [],
            p = this.getHeightCell(n),
            g = this.colModel;
            for (!u && e.push(this.generateRow(n, a)), 0 != i || !h || "left" != a && "lt" != a || (c = this.renderNumCell(n, h, a), f.push(c)), d = i; o >= d; d++) s = g[d],
            s.hidden || (c = this.generateCell(n, d, r, s, a, p), f.push(c));
            l = f.join(""),
            u ? t(u).append(l) : e.push(l, "</div>")
        },
        renderView: function(t, e, r, n, i) {
            if (null != r && null != n) {
                i = i || this.getCellRegion(t, Math.min(r, n));
                for (var o, a = [], l = this.data, s = this["$tbl_" + i], d = t; e >= d; d++) o = l[d],
                o && !o.pq_hidden && this.renderRow(a, o, d, r, n, i);
                s.append(a.join(""))
            }
        },
        scrollX: function(t, e) {
            var r = this.$cright[0];
            return t >= 0 ? void this.scrollXY(t, r.scrollTop, e) : r.scrollLeft
        },
        setCellDims: function(t) {
            for (var e, r, n = this,
            i = n.initV,
            o = n.iMerge,
            a = n._m(), l = n.colModel, s = n.numColWd, d = n.finalV, c = n.jump, u = (n.mcLaid, n.data), h = (n.riOffset, n.initH), f = n.finalH, p = n.freezeCols, g = n.freezeRows, v = (n.leftArr, n.leftWdArr, 0); d >= v; v++) {
                v = c(i, g, v);
                var m, w = n.get$Row(v),
                x = n.getHeightR(v),
                y = n.getTop(v),
                C = u[v],
                _ = n.getHeightCell(v);
                if (C && !C.pq_hidden) {
                    n.setRowDims(w, x, y);
                    for (var I = s ? -1 : 0; f >= I; I++) I = c(h, p, I),
                    (0 > I || !l[I].hidden) && (a && (e = o.ismergedCell(v, I)) || (m = n.getCell(v, I), m && (r = m.style, r.height = ( - 1 == I ? x: _) + "px", t || (r.width = n.getWidthCell(I) + "px", r.left = n.getLeft(I) + "px"))))
                }
            }
            var b = n.getMergeCells(),
            q = b.length;
            for (v = 0; q > v; v++) {
                m = b[v];
                var R = n.getCellIndx(m);
                if (R) {
                    var D = R[0],
                    M = R[1],
                    e = o.getRootCell(D, M),
                    T = e.v_ri;
                    w = n.get$Row(T),
                    x = n.getHeightR(T),
                    _ = n.getHeightCellM(D, e.o_rc),
                    y = n.getTop(T),
                    n.setRowDims(w, x, y),
                    r = m.style,
                    r.height = _ + "px",
                    t || (r.width = n.getWidthCellM(M, e.o_cc) + "px", r.left = n.getLeft(M) + "px")
                }
            }
        },
        setRowDims: function(t, e, r) {
            t.css({
                height: e,
                top: r,
                width: "100%"
            })
        },
        setColWdArr: function(t, e) {
            var r, n, i, o, a, l, s, d, c = e,
            u = this,
            h = u.jump,
            f = u.colModel,
            p = u.data,
            g = u.freezeRows,
            v = this.maxHt + "px",
            m = u.iMerge,
            w = u.initV,
            x = u.isBody(),
            y = u.isSum(),
            C = x || y,
            _ = u.isHead() ? u.that.headerCells.length - 1 : u.finalV;
            if (_ >= 0) for (; c >= t; c--) if (n = f[c], !n.hidden && -1 == (n.width + "").indexOf("%") && (l = C ? n.width: n._minWidth)) {
                for (r = 0; _ >= r; r++) if (r = h(w, g, r), o = p[r], o && !o.pq_hidden) {
                    if (s = !0, d = m.ismergedCell(r, c)) {
                        if (1 == d) continue;
                        if (d = m.getRootCell(r, c), d.v_rc > 1 || d.v_cc > 1) {
                            if (d.v_cc > 1) continue;
                            s = !1
                        }
                        i = u.getCell(d.o_ri, d.o_ci)
                    } else i = u.getCell(r, c);
                    i.parentNode.style.width = v,
                    s && (i.style.width = "auto"),
                    a = i.offsetWidth + 1,
                    l = Math.max(a, l)
                }
                if (! (l > 0)) throw "wd NaN";
                n.width = u.colwdArr[c] = l,
                n._resized = !0
            }
        },
        setRowHtArr: function(t, e, r) {
            for (var n, i, o, a, l, s, d, c, u, h, f, p = e,
            g = this,
            v = g.jump,
            m = g.rowhtArr,
            w = g.data,
            x = g.colModel,
            y = g._m(), C = g.diffV, _ = g.freezeCols, I = g.rowHt, b = g.iMerge, q = g.rowHtDetail, R = g.initH, D = g.finalH; p >= t; p--) if (l = w[p], l && !l.pq_hidden && !l.pq_gtitle && !l.pq_gsummary) {
                for (f = q ? g.getHtDetail(l, q) : 0, c = r ? m[p] - f: I, n = 0; D >= n; n++) if (i = n, n = v(R, _, n), !x[n].hidden) {
                    if (u = y && b.ismergedCell(p, n)) {
                        if (1 == u || C) continue;
                        u = b.getRootCell(p, n),
                        s = g.getCell(u.o_ri, u.o_ci)
                    } else s = g.getCell(p, n);
                    s.style.height = "auto",
                    d = s.offsetHeight,
                    u && (h = u.o_rc - (u.v_ri - u.o_ri) - 1, d -= u.v_rc > 1 ? g.getHeightCellDirty(u.v_ri + 1, h) : 0),
                    c = Math.max(d, c)
                }
                a = c + f,
                m[p] != a && (m[p] = l.pq_ht = a, o = !0)
            }
            return o
        },
        setTimer: function(t) {
            var e = {};
            return function(r, n, i) {
                n = t + n,
                clearTimeout(e[n]);
                var o = this;
                e[n] = setTimeout(function() {
                    o.that.element && r.call(o)
                },
                i || 300)
            }
        }
    },
    new e.cVirtual)
} (jQuery),
function(t) {
    pq.cRenderBody = function(t, e) {
        var r = this,
        n = r.uuid = t.uuid,
        i = t.options,
        o = (r.$center = e.$center, r.$ele = e.$b),
        a = r.$sum = e.$sum,
        l = r.$h = e.$h,
        s = i.postRenderInterval;
        r.that = t,
        r.setTimer = r.setTimer(n),
        r.cellPrefix = "pq-body-cell-u" + n + "-",
        r.rowPrefix = "pq-body-row-u" + n + "-",
        r.cellCls = "pq-grid-cell",
        r.iMerge = t.iMerge,
        r.rowHt = i.rowHt || 30, // DTS 27->30
        r.rowHtDetail = i.detailModel.height,
        r.iRenderHead = t.iRenderHead = new pq.cRenderHead(t, l),
        r.iRenderSum = t.iRenderSum = new pq.cRenderSum(t, a),
        t.on("headHtChanged", r.onHeadHtChanged(r)),
        null != s && t.on("refresh refreshRow refreshCell refreshColumn",
        function() {
            0 > s ? r.postRenderAll() : r.setTimer(r.postRenderAll, "postRender", s)
        }),
        r.preInit(o),
        t.on("refresh softRefresh", r.onRefresh.bind(r))
    },
    pq.cRenderBody.prototype = t.extend({},
    new t.paramquery.cGenerateView, new pq.cRender, {
        setHtCont: function(t) {
            this.dims.htCont = t,
            this.$ele.css("height", t)
        },
        createColDefs: function(t, e) {
            for (var r, n = this.that,
            i = n.colModel,
            o = this.freezeCols,
            a = [], l = this.jump, s = 0; e >= s; s++) s = l(t, o, s),
            r = i[s],
            r.hidden || a.push({
                column: r,
                colIndx: s
            });
            this.iRenderHead.colDef = this.colDef = a
        },
        flex: function(t) {
            this.iRenderHead.autoWidth(t),
            this.iRenderSum.autoWidth(t),
            this.autoWidth(t),
            this.that.refresh({
                colModel: !0,
                source: "flex",
                soft: !0
            })
        },
        getTblCls: function(t) {
            var e = [];
            return t.rowBorders && e.push("pq-td-border-top"),
            t.columnBorders && e.push("pq-td-border-right"),
            t.wrap || e.push("pq-no-wrap"),
            e.join(" ")
        },
        init: function(t) {
            t = t || {};
            var e, r = this,
            n = r.that,
            i = t.soft,
            o = !i,
            a = t.source,
            l = r.iRenderHead,
            s = r.iRenderSum,
            d = n.options,
            c = d.scrollModel,
            u = (r.freezeCols = d.freezeCols || 0, r.freezeRows = d.freezeRows, r.numberCell = d.numberCell),
            h = r.colModel = n.colModel,
            f = ("pq-table " + r.getTblCls(d), r.width = d.width, r.height = d.height, r.$ele);
            o && (r.dims = n.dims, r.autoFit = c.autoFit, r.pauseTO = c.timeout, e = n.pdata || [], f.find(".pq-grid-norows").css("display", e.length ? "none": ""), r.data = e, r.maxHt = pq.cVirtual.maxHt, r.riOffset = n.riOffset, r.cols = h.length, r.rows = e.length, n._mergeCells && (r._m = function() {
                return ! 0
            }), r.autoRow = d.autoRow, r.initRowHtArrSuper(), d.stripeRows && r.initStripeArr()),
            r.refreshColumnWidths(),
            r.numColWd = l.numColWd = s.numColWd = u.show ? u.outerWidth: 0,
            r.initColWdArrSuper(),
            s.init(t),
            t.header ? l.init(t) : r.setPanes(),
            s.initPost(t),
            t.header && l.initPost(t),
            r.$cright[0].scrollTop > r.getTop(r.rows) || (o ? r.refreshAllCells({
                source: a
            }) : i && (r.setCellDims(), r.refresh({
                source: a
            }), n._trigger("softRefresh")))
        },
        initColWdArr: function() {
            for (var t, e = this.colModel,
            r = e.length,
            n = (this.leftArr = this.iRenderHead.leftArr = this.iRenderSum.leftArr = [], 0), i = this.colwdArr = this.iRenderHead.colwdArr = this.iRenderSum.colwdArr = []; r > n; n++) t = e[n],
            i[n] = t.hidden ? 0 : t.outerWidth
        },
        initColWdArrSuper: function() {
            this.initColWdArr(),
            this.setTopArr(0, !0),
            this.assignTblDims(!0)
        },
        inViewport: function(t, e, r) {
            r = r || this.getCell(t, e);
            var n = this.dims,
            i = n.left - 2,
            o = n.right - (n.wdCont - n.wdContClient) + 2,
            a = n.top - 2,
            l = n.bottom - (n.htCont - n.htContClient) + 2,
            s = this.getCellRegion(t, e),
            d = (this.initH, this.finalH, this.initV, this.finalV, r.parentNode),
            c = r.offsetLeft - n.wdContLeft,
            u = d.offsetTop - n.htContTop,
            h = c + r.offsetWidth,
            f = u + r.offsetHeight;
            return "right" == s ? c > i && o > h && u > a && l > f: "tr" == s ? c > i && o > h: "left" == s ? u > a && l > f: !0
        },
        isBody: function() {
            return ! 0
        },
        onHeadHtChanged: function(t) {
            return function(e, r) {
                t.setBodyHeight(),
                t.setPanes()
            }
        },
        onMouseWheel: function(t) {
            var e;
            return function(t) {
                var r = this;
                r.style["pointer-events"] = "none",
                clearTimeout(e),
                e = setTimeout(function() {
                    r.style["pointer-events"] = ""
                },
                300)
            }
        },
        onNativeScroll: function(t) {
            return function() {
                var e = t.$cright[0],
                r = t.that,
                n = e.scrollLeft,
                i = e.scrollTop;
                t.iRenderHead.setScrollLeft(n),
                t.iRenderSum.setScrollLeft(n),
                t.$cleft[0].scrollTop = i,
                t.$ctr[0].scrollLeft = n,
                t.refresh(),
                r._trigger("scroll"),
                t.setTimer(function() {
                    r._trigger("scrollStop")
                },
                "scrollStop", t.pauseTO)
            }
        },
        onRefresh: function(t, e) {
            "autoRow" != e.source && this.initRefreshTimer(e.hChanged)
        },
        onRefreshTimer: function(t, e) {
            return function() {
                var r = t.$cright[0];
                t.autoRow && t.autoHeight({
                    hChanged: e
                }),
                r.scrollTop = r.scrollTop,
                r.scrollLeft = r.scrollLeft
            }
        },
        pageDown: function(t, e) {
            var r, n = this,
            i = n.topArr,
            o = i[t],
            a = t,
            l = n.dims,
            s = this.$cright[0].scrollTop,
            d = 95 * (l.htContClient - l.htContTop) / 100,
            c = o + d,
            u = t,
            h = i.length - 1;
            n.scrollY(s + d,
            function() {
                for (u = t < n.initV ? n.initV: t; h >= u; u++) if (r = i[u], r > o && (o = r, a = u - 1), r > c) {
                    a = u - 1;
                    break
                }
                e(a)
            })
        },
        pageUp: function(t, e) {
            for (var r, n = this,
            i = n.topArr,
            o = i[t], a = this.$cright[0].scrollTop, l = n.dims, s = 80 * (l.htContClient - l.htContTop) / 100, d = o - s, c = t, u = t; u >= 0; u--) if (r = i[u], o > r && (o = r, c = u), d > r) {
                c = u;
                break
            }
            n.scrollY(a - s,
            function() {
                e(c)
            })
        },
        postRenderAll: function() {
            for (var t, e, r, n, i, o, a = this,
            l = a.that,
            s = a.riOffset,
            d = a.freezeCols,
            c = a.freezeRows,
            u = a.jump,
            h = a.initH,
            f = a.finalH,
            p = a.initV,
            g = a.finalV,
            v = 0,
            m = a.iMerge,
            w = a.data,
            x = a.colModel; f >= v; v++) if (v = u(h, d, v), e = x[v], !e.hidden && (o = e.postRender)) for (t = 0; g >= t; t++) t = a.jump(p, c, t),
            r = w[t],
            r.pq_hidden || (i = m.getRootCellO(t + s, v, !0), n = a.getCell(i.rowIndxPage, i.colIndx), n && !n._postRender && (i.cell = n, l.callFn(o, i), n._postRender = !0))
        },
        refreshRow: function(t) {
            var e, r, n = this,
            i = n.initH,
            o = n.finalH,
            a = n.freezeCols,
            l = n.get$Row(t),
            s = [];
            l.each(function(t, e) {
                var r = n.getRowIndx(e);
                s.push(r[1])
            }),
            n.that._trigger("beforeViewEmpty", null, {
                rowIndxPage: t
            }),
            l.remove(),
            s.forEach(function(l) {
                "left" == l || "lt" == l ? (e = 0, r = a - 1) : (e = i, r = o),
                n.renderView(t, t, e, r, l)
            })
        },
        _scrollRow: function(t, e) {
            var r, n = this,
            i = n.dims,
            o = i[e ? "wdContClient": "htContClient"],
            a = e ? "scrollLeft": "scrollTop",
            l = n.$cright[0],
            s = n[e ? "colModel": "data"].length,
            d = n[e ? "freezeCols": "freezeRows"],
            c = l[a],
            u = i[e ? "wdContLeft": "htContTop"];
            if (d > t || t > s - 1) return c;
            var h = n.getTopSafe(t, e),
            f = n[e ? "getWidthCell": "getHeightR"](t);
            return null != h ? (h + f + 1 > c + o ? r = h + f + 1 - o: c + u > h && (r = h - u, r = 0 > r ? 0 : r), r >= 0 ? r: c) : void 0
        },
        scrollColumn: function(t, e) {
            var r = this._scrollRow(t, !0);
            this.scrollX(r, e)
        },
        scrollRow: function(t, e) {
            var r = this._scrollRow(t);
            this.scrollY(r, e)
        },
        scrollCell: function(t, e, r) {
            var n = this._scrollRow(t),
            i = this._scrollRow(e, !0);
            this.scrollXY(i, n, r)
        },
        scrollY: function(t, e) {
            var r = this.$cright[0];
            return null == t ? r.scrollTop: (t = t >= 0 ? t: 0, void this.scrollXY(r.scrollLeft, t, e))
        },
        scrollXY: function(t, e, r) {
            var n, i, o = this.$cright[0],
            a = this.that,
            l = o.scrollLeft,
            s = o.scrollTop;
            return t >= 0 ? (o.scrollLeft = t, o.scrollTop = e, n = o.scrollLeft, i = o.scrollTop, r && (n == l && i == s ? r() : a.one("scroll",
            function() {
                n == l ? r() : a.one("scrollHead", r)
            })), void 0) : [l, s]
        },
        setBodyHeight: function() {
            var t = this;
            t.dims;
            t.setPanes()
        },
        getSBHt: function(t) {
            var e = this.dims,
            r = this.that.options,
            n = pq.cVirtual.SBDIM;
            return this.autoFit ? 0 : ("flex" != this.width || r.maxWidth) && t > e.wdCenter + n ? n: 0
        },
        getSBWd: function() {
            var t = this.dims;
            return t.htCenter ? pq.cVirtual.SBDIM: 0
        },
        setPanes: function() {
            var t, e, r, n = this,
            i = n.that,
            o = i.options,
            a = n.autoFit,
            l = n.dims,
            s = l.htCenter - l.htHead - l.htSum,
            d = l.wdCenter,
            c = n.$ele,
            u = n.freezeCols,
            h = n.freezeRows,
            f = n.$cright,
            p = f[0],
            g = n.$cleft,
            v = n.$clt,
            m = n.$ctr,
            w = n.getLeft(u),
            x = pq.cVirtual.SBDIM,
            y = l.wdTbl,
            C = Math.max(l.htTbl, 30) + n.getSBHt(y),
            _ = n.getTopSafe(h);
            m.css("display", h ? "": "none"),
            g.css("display", w ? "": "none"),
            v.css("display", w && h ? "": "none"),
            f.css("overflow-y", ""),
            "flex" == n.height ? (s > 0 && C > s ? C = Math.min(C, s) : f.css("overflow-y", "hidden"), n.setHtCont(C)) : n.setHtCont(s),
            a && n.getSBWd() && f.css("overflow-y", "scroll"),
            f.css("overflow-x", a ? "hidden": ""),
            "flex" == n.width ? (y = parseInt(c[0].style.height) >= l.htTbl - 1 ? y: y + x, o.maxWidth && y > d ? y = Math.min(y, d) : f.css("overflow-x", "hidden"), n._flexWidth = y, c.width(n._flexWidth)) : c.css("width", ""),
            n.htCont = l.htCont = f.height(),
            n.wdCont = l.wdCont = f.width(),
            l.htContClient = r = p.clientHeight,
            l.wdContClient = t = p.clientWidth,
            w > t && (f.css("overflow-x", "hidden"), w = t),
            g.css("width", w),
            v.css("width", w),
            m.width(t),
            g.height(r),
            e = p.offsetWidth,
            n.iRenderHead.setWidth(e, t),
            n.iRenderSum.setWidth(e, t),
            _ > r && (f.css("overflow-y", "hidden"), _ = r),
            v.css("height", _),
            m.css("height", _),
            n.wdContLeft = l.wdContLeft = g.width(),
            n.htContTop = l.htContTop = m.height()
        }
    },
    new pq.cVirtual)
} (jQuery),
function(t) {
    function e(t) {
        this.that = t
    }
    t.paramquery.cMergeHead = e,
    e.prototype = {
        getRootCell: function(t, e) {
            for (var r = this.that,
            n = r.headerCells,
            i = n[t][e], o = i.rowSpan, a = i.leftPos; t && n[t - 1][a] == i;) t--;
            return {
                v_ri: t,
                o_ri: t,
                v_ci: r.getFirstVisibleCI(a),
                o_ci: a,
                v_rc: o,
                o_rc: o,
                v_cc: i.colSpan,
                o_cc: i.o_colspan
            }
        },
        ismergedCell: function(t, e) {
            var r, n, i, o, a = this.that,
            l = a.headerCells,
            s = l[t],
            d = s ? s[e] : "";
            if (d) if (r = d.leftPos, 0 != t && l[t - 1][e] === d || (o = a.getFirstVisibleCI(r)) != e) {
                if (d.colSpan) return ! 0
            } else if (n = d.rowSpan, i = d.colSpan, n && i && (n > 1 || i > 1)) return {
                o_ri: t,
                o_ci: r,
                v_rc: n,
                o_rc: n,
                v_cc: i,
                o_cc: d.o_colspan
            }
        },
        getClsStyle: function() {
            return {}
        }
    }
} (jQuery),
function(t) {
    pq.cRenderHS = t.extend({},
    new pq.cRender, {
        init: function(t) {
            t = t || {};
            var e, r = this,
            n = r.that,
            i = n.options,
            o = (r.freezeCols = i.freezeCols || 0, r.numberCell = i.numberCell, r.colModel = n.colModel),
            a = r.isHead(),
            l = r.isSum(),
            s = a ? i.autoRowHead: i.autoRowSum,
            d = (r.width = i.width, r.height = "flex", r.$ele, n.headerCells);
            r.freezeRows = 0;
            r.dims = n.dims,
            a ? e = r.data = i.showHeader ? i.filterModel.header ? d.concat([[]]) : d: [] : l && (e = r.data = i.summaryData || []),
            r.maxHt = pq.cVirtual.maxHt,
            r.riOffset = 0,
            r.cols = o.length,
            r.rows = e.length,
            a ? d.length > 1 && (r._m = function() {
                return ! 0
            }) : i.stripeRows && r.initStripeArr(),
            r.autoRow = null == s ? i.autoRow: s,
            r.initRowHtArrSuper(),
            r.assignTblDims(!0),
            r.setPanes()
        },
        initPost: function(t) {
            t = t || {};
            var e = this;
            e.autoRow;
            e.data.length && (t.soft ? (e.setCellDims(), e.refresh()) : e.refreshAllCells())
        },
        onNativeScroll: function(t) {
            return function() {
                t.refresh(),
                t.isHead() && t.that._trigger("scrollHead")
            }
        },
        onRefresh: function(t, e) {
            this.initRefreshTimer(e.hChanged)
        },
        refreshHS: function() {
            this.init(),
            this.initPost()
        },
        setPanes: function() {
            var t = this,
            e = t.that,
            r = t.dims,
            n = t.$ele,
            i = t.freezeCols,
            o = t.$cright,
            a = o[0],
            l = t.$cleft,
            s = t.getLeft(i),
            d = t.isHead(),
            c = t.isSum(),
            u = t.getTopSafe(t.rows);
            t.data.length;
            l.css("display", s ? "": "none"),
            n.height(u),
            d ? (r.htHead = u, e._trigger("headHtChanged")) : c && (r.htSum = u, e._trigger("headHtChanged")),
            t.htCont = o.height(),
            t.wdCont = o.width(),
            l.css("width", s),
            l.height(a.clientHeight),
            t.wdContLeft = l.width(),
            t.htContTop = 0
        },
        setScrollLeft: function(t) {
            var e = this.$cright;
            e && this.scrollLeft !== t && (this.scrollLeft = e[0].scrollLeft = t)
        },
        setWidth: function(t, e) {
            this.$ele[0].style.width = t + "px",
            this.$spacer.width(t - e)
        }
    })
} (jQuery),
function(t) {
    var e = t.paramquery,
    r = pq.cRenderHead = function(t, r) {
        this.that = t;
        var n = t.options,
        i = this,
        o = i.uuid = t.uuid;
        i.iMerge = new e.cMergeHead(t),
        i.$ele = r,
        i.height = "flex",
        i.scrollTop = 0,
        i.rowHt = n.rowHtHead || 31, // DTS 28->31
        i.cellCls = "pq-grid-col",
        i.setTimer = i.setTimer(o),
        i.cellPrefix = "pq-head-cell-u" + o + "-",
        i.rowPrefix = "pq-head-row-u" + o + "-",
        i.preInit(r),
        r.on("click",
        function(t) {
            return i.onHeaderClick(t)
        }),
        t.on("headerKeyDown", i.onHeaderKeyDown.bind(i)).on("refreshHeader softRefresh", i.onRefresh.bind(i))
    };
    r.prototype = t.extend({},
    pq.cRenderHS, new e.cHeader, new e.cHeaderSearch, {
        getRowClsStyleAttr: function(t) {
            var e = this.that.headerCells.length,
            r = "";
            return e == t ? r = "pq-grid-header-search-row": t == e - 1 && (r = "pq-grid-title-row"),
            [r, "", ""]
        },
        getTblCls: function(t) {
            var e = "pq-grid-header-table";
            return t.hwrap ? e: e + " pq-no-wrap"
        },
        isHead: function() {
            return ! 0
        },
        onRefreshTimer: function(t, e) {
            return function() {
                var r = t.$cright[0];
                t.autoRow && t.autoHeight({
                    timer: !1,
                    hChanged: e
                }),
                r.scrollTop = 0,
                r.scrollLeft = r.scrollLeft,
                t.onCreateHeader(),
                t.refreshResizeColumn(),
                t.refreshHeaderSortIcons()
            }
        },
        _resizeId: function(t) {
            return "pq-resize-div-" + this.uuid + "-" + t
        },
        _resizeCls: function() {
            return "pq-resize-div-" + this.uuid
        },
        _resizeDiv: function(t) {
            return this.getById(this._resizeId(t))
        },
        refreshResizeColumn: function() {
            var t, e, r, n, i, o = this.initH,
            a = this.colModel,
            l = this._resizeCls(),
            s = this.finalH,
            d = this.numberCell,
            c = this.freezeCols,
            u = [],
            h = [],
            f = d.show ? -1 : 0;
            for (this.$ele.find("." + l).remove(); s >= f; f++) {
                if (f >= o) e = h;
                else {
                    if (! (c > f)) continue;
                    e = u
                }
                t = f >= 0 ? a[f] : d,
                t.hidden || t.resizable === !1 || this._resizeDiv(f) || (r = this.getLeft(f + 1), n = r - 5, i = this._resizeId(f), e.push("<div id='", i, "' pq-col-indx='", f, "' style='left:", n, "px;'", " class='pq-grid-col-resize-handle " + l + "'>&nbsp;</div>"))
            }
            u.length && this.$cleft.append(u.join("")),
            h.length && this.$cright.append(h.join(""))
        },
        renderCell: function(t) {
            var e, r = t.rowData,
            n = t.rowIndx,
            i = t.colIndx,
            o = t.attr,
            a = t.cls,
            l = t.style,
            s = r[i];
            return s ? this.createHeaderCell(n, i, s, o, a, l) : (e = this.renderFilterCell(t.column, i, a), "<div " + o + " class='" + a.join(" ") + "' style='" + l.join("") + "'>" + e + "</div>")
        }
    })
} (jQuery),
function(t) {
    var e = t.paramquery,
    r = pq.cRenderSum = function(t, e) {
        var r = t.options,
        n = this,
        i = n.uuid = t.uuid;
        n.that = t,
        n.iMerge = {
            ismergedCell: function() {}
        },
        n.$ele = e,
        n.height = "flex",
        n.scrollTop = 0,
        n.rowHt = r.rowHtSum || 30, // DTS 27->30
        n.cellCls = "pq-grid-cell",
        n.setTimer = n.setTimer(i),
        n.cellPrefix = "pq-sum-cell-u" + i + "-",
        n.rowPrefix = "pq-sum-row-u" + i + "-",
        n.preInit(e),
        t.on("refreshSum softRefresh", n.onRefresh.bind(n))
    };
    r.prototype = t.extend({},
    new e.cGenerateView, pq.cRenderHS, {
        getTblCls: function(t) {
            var e = ["pq-grid-summary-table"];
            return t.rowBorders && e.push("pq-td-border-top"),
            t.columnBorders && e.push("pq-td-border-right"),
            t.wrap || e.push("pq-no-wrap"),
            e.join(" ")
        },
        isSum: function() {
            return ! 0
        },
        onRefreshTimer: function(t, e) {
            return function() {
                var r = t.$cright[0];
                t.autoRow && t.autoHeight({
                    timer: !1,
                    hChanged: e
                }),
                r.scrollTop = 0,
                r.scrollLeft = r.scrollLeft
            }
        }
    })
} (jQuery);